https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102762
Bug ID: 102762
Summary: ICE with -O2: Segmentation fault, memcpy, copy_bb
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: cnsun at uwaterloo dot ca
Target Milestone: ---
$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.gzh6IUhxke-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20211014 (experimental) [master -gee9fa8a57] (GCC)
$ cat mutant.c
foo(a, b) {
log_bad_request(0, __builtin_va_arg_pack());
foo(0);
}
$ gcc-trunk -w -O2 mutant.c
during IPA pass: inline
mutant.c: In function ‘foo’:
mutant.c:3:3: internal compiler error: Segmentation fault
3 | foo(0);
| ^~~~~~
0xf8c8d3 crash_signal
/tmp/tmp.gzh6IUhxke-gcc-builder/gcc/gcc/toplev.c:326
0x101972c memcpy
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:34
0x101972c copy_bb
/tmp/tmp.gzh6IUhxke-gcc-builder/gcc/gcc/tree-inline.c:2130
0x101aac2 copy_cfg_body
/tmp/tmp.gzh6IUhxke-gcc-builder/gcc/gcc/tree-inline.c:3070
0x101aac2 copy_body
/tmp/tmp.gzh6IUhxke-gcc-builder/gcc/gcc/tree-inline.c:3323
0x101dc06 expand_call_inline
/tmp/tmp.gzh6IUhxke-gcc-builder/gcc/gcc/tree-inline.c:5108
0x101f591 gimple_expand_calls_inline
/tmp/tmp.gzh6IUhxke-gcc-builder/gcc/gcc/tree-inline.c:5303
0x101f591 optimize_inline_calls(tree_node*)
/tmp/tmp.gzh6IUhxke-gcc-builder/gcc/gcc/tree-inline.c:5476
0xd2eddb inline_transform(cgraph_node*)
/tmp/tmp.gzh6IUhxke-gcc-builder/gcc/gcc/ipa-inline-transform.c:790
0xe93b34 execute_one_ipa_transform_pass
/tmp/tmp.gzh6IUhxke-gcc-builder/gcc/gcc/passes.c:2290
0xe93b34 execute_all_ipa_transforms(bool)
/tmp/tmp.gzh6IUhxke-gcc-builder/gcc/gcc/passes.c:2337
0xae3d29 cgraph_node::expand()
/tmp/tmp.gzh6IUhxke-gcc-builder/gcc/gcc/cgraphunit.c:1821
0xae514f expand_all_functions
/tmp/tmp.gzh6IUhxke-gcc-builder/gcc/gcc/cgraphunit.c:1992
0xae514f symbol_table::compile()
/tmp/tmp.gzh6IUhxke-gcc-builder/gcc/gcc/cgraphunit.c:2356
0xae802b symbol_table::compile()
/tmp/tmp.gzh6IUhxke-gcc-builder/gcc/gcc/cgraphunit.c:2269
0xae802b symbol_table::finalize_compilation_unit()
/tmp/tmp.gzh6IUhxke-gcc-builder/gcc/gcc/cgraphunit.c:2537
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.