https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93631
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |msebor at gcc dot gnu.org
Summary|internal compiler error: in |[8/9/10 Regression] ICE on
|gimple_ca ll_arg, at |an invalid strcmp call in
|gimple.h:3258 |gimple_ca ll_arg, at
| |gimple.h:3258
Known to fail| |7.3.0, 8.3.0, 9.2.0
--- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> ---
Both test cases are diagnosed with two instances of
-Wimplicit-function-declaration, the smaller of the two with:
$ gcc -S pr93631.c
pr93631.c:1:18: warning: implicit declaration of function ‘strcmp’
[-Wimplicit-function-declaration]
1 | int f2 ( int x [ strcmp ( ) ] , int b ) { return x[0] - b ; }
| ^~~~~~
pr93631.c:1:18: warning: too few arguments to built-in function ‘strcmp’
expecting 2 [-Wbuiltin-declaration-mismatch]
during GIMPLE pass: lower
pr93631.c: In function ‘f2’:
pr93631.c:1:5: internal compiler error: in gimple_call_arg, at gimple.h:3258
1 | int f2 ( int x [ strcmp ( ) ] , int b ) { return x[0] - b ; }
| ^~
The second warning has started to be issued with r266194 but it doesn't prevent
the call from being treated as a built-in (the function only prevents that for
errors, not for warning). There are a couple more checks later on for
incompatible built-in calls that look like should catch this but don't.
Changing the convert_arguments() function in the C front-end that issues the
second warning to treat this case as an error (while still only issuing a
warning) avoids the GIMPLE ICE but then causes another ICE later on:
$ gcc -S -Wall -Wextra -Wpedantic t.c
t.c:1:18: warning: implicit declaration of function ‘strcmp’
[-Wimplicit-function-declaration]
1 | int f2 ( int x [ strcmp ( ) ] , int b ) { return x[0] - b ; }
| ^~~~~~
t.c:1:18: warning: too few arguments to built-in function ‘strcmp’ expecting 2
[-Wbuiltin-declaration-mismatch]
t.c: In function ‘f2’:
t.c:1:14: warning: unused parameter ‘x’ [-Wunused-parameter]
1 | int f2 ( int x [ strcmp ( ) ] , int b ) { return x[0] - b ; }
| ~~~~^~~~~~~~~~~~~~~~
t.c:1:1: warning: control reaches end of non-void function [-Wreturn-type]
1 | int f2 ( int x [ strcmp ( ) ] , int b ) { return x[0] - b ; }
| ^~~
during RTL pass: expand
t.c:1:5: internal compiler error: in adjust_one_expanded_partition_var, at
cfgexpand.c:1463
1 | int f2 ( int x [ strcmp ( ) ] , int b ) { return x[0] - b ; }
| ^~
0xb06387 adjust_one_expanded_partition_var
/src/gcc/trunk/gcc/cfgexpand.c:1463
0xb184b4 execute
/src/gcc/trunk/gcc/cfgexpand.c:6457
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
For reference, bisection of the reported ICE points to r243832:
commit d17680f342ef5407303d8c76f8faa0762f83c3f7
Author: Jakub Jelinek <[email protected]>
Date: Wed Dec 21 01:07:49 2016 +0100
re PR c/77767 (Side-effect from VLA array parameters lost)
PR c/77767
* c-decl.c (grokdeclarator): If *expr is non-NULL, append
expression
to *expr instead of overwriting it.
* gcc.c-torture/execute/pr77767.c: New test.
From-SVN: r243832