https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105211
Bug ID: 105211 Summary: ICE: SIGSEGV in contains_struct_check (tree.h:3570) with -Os -ffast-math and __builtin_roundf() Product: gcc Version: 12.0 Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: zsojka at seznam dot cz Target Milestone: --- Host: x86_64-pc-linux-gnu Target: x86_64-pc-linux-gnu Created attachment 52775 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52775&action=edit reduced testcase Compiler output: $ x86_64-pc-linux-gnu-gcc -Os -ffast-math testcase.c -wrapper valgrind,-q ==23239== Invalid read of size 2 ==23239== at 0xE330C0: contains_struct_check (tree.h:3570) ==23239== by 0xE330C0: build_call_nofold_loc(unsigned int, tree_node*, int, ...) (builtins.cc:2735) ==23239== by 0xE39B22: expand_builtin_int_roundingfn_2(tree_node*, rtx_def*) (builtins.cc:2974) ==23239== by 0xE4A1AA: expand_builtin(tree_node*, rtx_def*, rtx_def*, machine_mode, int) (builtins.cc:7085) ==23239== by 0xFAD188: expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool) (expr.cc:11536) ==23239== by 0xFB9B3D: store_expr(tree_node*, rtx_def*, int, bool, bool) (expr.cc:6087) ==23239== by 0xFBB3F0: expand_assignment(tree_node*, tree_node*, bool) [clone .part.0] (expr.cc:5819) ==23239== by 0xE70EFC: expand_call_stmt (cfgexpand.cc:2829) ==23239== by 0xE70EFC: expand_gimple_stmt_1 (cfgexpand.cc:3869) ==23239== by 0xE70EFC: expand_gimple_stmt(gimple*) (cfgexpand.cc:4033) ==23239== by 0xE7730E: expand_gimple_basic_block(basic_block_def*, bool) (cfgexpand.cc:6080) ==23239== by 0xE78F0F: (anonymous namespace)::pass_expand::execute(function*) (cfgexpand.cc:6806) ==23239== by 0x128A17A: execute_one_pass(opt_pass*) (passes.cc:2638) ==23239== by 0x128AA3F: execute_pass_list_1(opt_pass*) (passes.cc:2738) ==23239== by 0x128AA78: execute_pass_list(function*, opt_pass*) (passes.cc:2749) ==23239== Address 0x0 is not stack'd, malloc'd or (recently) free'd ==23239== during RTL pass: expand testcase.c: In function 'foo': testcase.c:4:10: internal compiler error: Segmentation fault 4 | return __builtin_roundf (f); | ^~~~~~~~~~~~~~~~~~~~ 0x13928ff crash_signal /repo/gcc-trunk/gcc/toplev.cc:322 0xe330c0 contains_struct_check(tree_node*, tree_node_structure_enum, char const*, int, char const*) /repo/gcc-trunk/gcc/tree.h:3570 0xe330c0 build_call_nofold_loc /repo/gcc-trunk/gcc/builtins.cc:2735 0xe39b22 expand_builtin_int_roundingfn_2 /repo/gcc-trunk/gcc/builtins.cc:2974 0xe4a1aa expand_builtin(tree_node*, rtx_def*, rtx_def*, machine_mode, int) /repo/gcc-trunk/gcc/builtins.cc:7085 0xfad188 expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool) /repo/gcc-trunk/gcc/expr.cc:11536 0xfb9b3d store_expr(tree_node*, rtx_def*, int, bool, bool) /repo/gcc-trunk/gcc/expr.cc:6087 0xfbb3f0 expand_assignment(tree_node*, tree_node*, bool) /repo/gcc-trunk/gcc/expr.cc:5819 0xe70efc expand_call_stmt /repo/gcc-trunk/gcc/cfgexpand.cc:2829 0xe70efc expand_gimple_stmt_1 /repo/gcc-trunk/gcc/cfgexpand.cc:3869 0xe70efc expand_gimple_stmt /repo/gcc-trunk/gcc/cfgexpand.cc:4033 0xe7730e expand_gimple_basic_block /repo/gcc-trunk/gcc/cfgexpand.cc:6080 0xe78f0f execute /repo/gcc-trunk/gcc/cfgexpand.cc:6806 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. $ x86_64-pc-linux-gnu-gcc -v Using built-in specs. COLLECT_GCC=/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-gcc COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r12-8072-20220410001634-g71cac7de8f1-checking-yes-rtl-df-extra-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/12.0.1/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++ --enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra --with-cloog --with-ppl --with-isl --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --with-ld=/usr/bin/x86_64-pc-linux-gnu-ld --with-as=/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch --prefix=/repo/gcc-trunk//binary-trunk-r12-8072-20220410001634-g71cac7de8f1-checking-yes-rtl-df-extra-amd64 Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 12.0.1 20220410 (experimental) (GCC)