* [C PATCH] Fix ICE with invalid function call (PR c/64778)
@ 2015-01-26 21:27 Jakub Jelinek
2015-01-26 21:57 ` Marek Polacek
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2015-01-26 21:27 UTC (permalink / raw)
To: Joseph S. Myers, Marek Polacek; +Cc: gcc-patches
Hi!
On the following testcase we ICE, because we end up with a CALL_EXPR
with error_mark_node argument and gimplification can't cope with that.
Normally, if one or more arguments are error_mark_node we return -1
and drop the whole call, but if we also report too many arguments,
we failed to do so.
Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?
2015-01-26 Jakub Jelinek <jakub@redhat.com>
PR c/64778
* c-typeck.c (convert_arguments): Return -1 if there are
error_args, even if we've diagnosed too many arguments.
* gcc.dg/pr64778.c: New test.
--- gcc/c/c-typeck.c.jj 2015-01-15 23:39:03.000000000 +0100
+++ gcc/c/c-typeck.c 2015-01-26 12:09:57.151820878 +0100
@@ -3143,7 +3143,7 @@ convert_arguments (location_t loc, vec<l
else
error_at (loc, "too many arguments to function %qE", function);
inform_declaration (fundecl);
- return parmnum;
+ return error_args ? -1 : (int) parmnum;
}
if (selector && argnum > 2)
--- gcc/testsuite/gcc.dg/pr64778.c.jj 2015-01-26 12:18:12.216366230 +0100
+++ gcc/testsuite/gcc.dg/pr64778.c 2015-01-26 12:17:58.000000000 +0100
@@ -0,0 +1,10 @@
+/* PR c/64778 */
+/* { dg-do compile } */
+
+int
+foo (int p)
+{
+ int a;
+ a ^= foo (,); /* { dg-error "expected expression before|too many arguments" } */
+ return a;
+}
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [C PATCH] Fix ICE with invalid function call (PR c/64778)
2015-01-26 21:27 [C PATCH] Fix ICE with invalid function call (PR c/64778) Jakub Jelinek
@ 2015-01-26 21:57 ` Marek Polacek
0 siblings, 0 replies; 2+ messages in thread
From: Marek Polacek @ 2015-01-26 21:57 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Joseph S. Myers, gcc-patches
On Mon, Jan 26, 2015 at 10:10:56PM +0100, Jakub Jelinek wrote:
> Hi!
>
> On the following testcase we ICE, because we end up with a CALL_EXPR
> with error_mark_node argument and gimplification can't cope with that.
>
> Normally, if one or more arguments are error_mark_node we return -1
> and drop the whole call, but if we also report too many arguments,
> we failed to do so.
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
> trunk?
Ok.
Marek
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-01-26 21:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-26 21:27 [C PATCH] Fix ICE with invalid function call (PR c/64778) Jakub Jelinek
2015-01-26 21:57 ` Marek Polacek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).