https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100042
Bug ID: 100042
Summary: ICE in gimple_call_set_fndecl with -Os
-fsanitize=undefined -flto -fanalyzer
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: analyzer
Assignee: dmalcolm at gcc dot gnu.org
Reporter: acoplan at gcc dot gnu.org
Target Milestone: ---
Possibly a dup of PR98599, thought it might be worth reporting in any case:
$ cat test.cc
long *a;
void b(unsigned) { *a ^= 9 + *a >> 2; }
int c;
void d() { b(c); }
int main() { d(); }
$ aarch64-linux-gnu-gcc -Os -fsanitize=undefined -flto -fanalyzer test.cc
test.cc: In function ‘b’:
test.cc:2:30: warning: dereference of NULL ‘0B’ [CWE-476]
[-Wanalyzer-null-dereference]
2 | void b(unsigned) { *a ^= 9 + *a >> 2; }
| ^
‘main’: events 1-2
|
| 5 | int main() { d(); }
| | ^ ~
| | | |
| | | (2) calling ‘d’ from ‘main’
| | (1) entry to ‘main’
|
+--> ‘d’: events 3-4
|
| 4 | void d() { b(c); }
| | ^ ~
| | | |
| | | (4) calling ‘b’ from ‘d’
| | (3) entry to ‘d’
|
+--> ‘b’: events 5-6
|
| 2 | void b(unsigned) { *a ^= 9 + *a >> 2; }
| | ^ ~
| | | |
| | | (6) dereference of NULL
‘a’
| | (5) entry to ‘b’
|
during IPA pass: inline
test.cc: In function ‘main’:
test.cc:4:13: internal compiler error: in gimple_call_set_fndecl, at
gimple.h:3135
4 | void d() { b(c); }
| ^
0x7cc398 gimple_call_set_fndecl
/home/alecop01/toolchain/src/gcc/gcc/gimple.h:3135
0x7cc398 cgraph_edge::redirect_call_stmt_to_callee(cgraph_edge*)
/home/alecop01/toolchain/src/gcc/gcc/cgraph.c:1568
0xd731e0 redirect_all_calls(copy_body_data*, basic_block_def*)
/home/alecop01/toolchain/src/gcc/gcc/tree-inline.c:2962
0xd77f0e copy_cfg_body
/home/alecop01/toolchain/src/gcc/gcc/tree-inline.c:3117
0xd77f0e copy_body
/home/alecop01/toolchain/src/gcc/gcc/tree-inline.c:3300
0xd7b1ff expand_call_inline
/home/alecop01/toolchain/src/gcc/gcc/tree-inline.c:5123
0xd7c53a gimple_expand_calls_inline
/home/alecop01/toolchain/src/gcc/gcc/tree-inline.c:5313
0xd7c53a optimize_inline_calls(tree_node*)
/home/alecop01/toolchain/src/gcc/gcc/tree-inline.c:5486
0xa4fbb5 inline_transform(cgraph_node*)
/home/alecop01/toolchain/src/gcc/gcc/ipa-inline-transform.c:790
0xbd2e61 execute_one_ipa_transform_pass
/home/alecop01/toolchain/src/gcc/gcc/passes.c:2290
0xbd2e61 execute_all_ipa_transforms(bool)
/home/alecop01/toolchain/src/gcc/gcc/passes.c:2337
0x7d357a cgraph_node::expand()
/home/alecop01/toolchain/src/gcc/gcc/cgraphunit.c:1823
0x7d54b2 expand_all_functions
/home/alecop01/toolchain/src/gcc/gcc/cgraphunit.c:1994
0x7d54b2 symbol_table::compile()
/home/alecop01/toolchain/src/gcc/gcc/cgraphunit.c:2358
0x6eec23 lto_main()
/home/alecop01/toolchain/src/gcc/gcc/lto/lto.c:653
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.
lto-wrapper: fatal error: aarch64-linux-gnu-gcc returned 1 exit status
compilation terminated.
/home/alecop01/toolchain/build-aarch64-linux-gnu/install/bin/../lib/gcc/aarch64-linux-gnu/11.0.1/../../../../aarch64-linux-gnu/bin/ld:
error: lto-wrapper failed
collect2: error: ld returned 1 exit status