handle a call with less arguments than needed gracefully: don't inline yet
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Fri, 30 May 2008 16:30:38 +0000 (16:30 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Fri, 30 May 2008 16:30:38 +0000 (16:30 +0000)
[r19859]

ir/opt/opt_inline.c

index b12e7ef..6a605d4 100644 (file)
@@ -863,8 +863,12 @@ int inline_method(ir_node *call, ir_graph *called_graph) {
                /* types match, fine: when the frame is access, the inliner stops at can_inline() */
        }
 
-       assert(get_method_n_params(get_entity_type(ent)) ==
-              get_method_n_params(get_Call_type(call)));
+       if (get_method_n_params(get_entity_type(ent)) > get_method_n_params(get_Call_type(call))) {
+               /* this is a bad feature of C: without a prototype, we can can call a function with less
+                  parameters than needed. Currently we don't support this, although it would be
+                  to use Unknown than. */
+               return 0;
+       }
 
        irg = get_irn_irg(call);