https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105140

            Bug ID: 105140
           Summary: [10/11/12 Regression] ICE: SIGSEGV in
                    fold_convertible_p with conflicting function
                    redeclaration
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu

Created attachment 52741
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52741&action=edit
reduced testcase

Compiler output:
$ x86_64-pc-linux-gnu-gcc -Os testcase.c -wrapper valgrind,-q
testcase.c:6:1: warning: return type defaults to 'int' [-Wimplicit-int]
    6 | bar (int i, int j, int k, V v)
      | ^~~
testcase.c:6:1: warning: conflicting types for 'bar'
testcase.c:4:6: note: previous declaration of 'bar' with type 'void()'
    4 | void bar ();
      |      ^~~
testcase.c: In function 'bar':
testcase.c:6:1: note: the ABI for passing parameters with 64-byte alignment has
changed in GCC 4.6
    6 | bar (int i, int j, int k, V v)
      | ^~~
==4816== Invalid read of size 2
==4816==    at 0xFCE2B1: fold_convertible_p(tree_node const*, tree_node const*)
(fold-const.cc:2394)
==4816==    by 0x140EB40: force_value_to_type(tree_node*, tree_node*)
(tree-inline.cc:3457)
==4816==    by 0x1414B80: setup_one_parameter(copy_body_data*, tree_node*,
tree_node*, tree_node*, basic_block_def*, tree_node**) (tree-inline.cc:3549)
==4816==    by 0x141FC8A: initialize_inlined_parameters (tree-inline.cc:3642)
==4816==    by 0x141FC8A: expand_call_inline(basic_block_def*, gimple*,
copy_body_data*, bitmap_head*) (tree-inline.cc:5017)
==4816==    by 0x1422336: gimple_expand_calls_inline (tree-inline.cc:5320)
==4816==    by 0x1422336: optimize_inline_calls(tree_node*)
(tree-inline.cc:5492)
==4816==    by 0x239FE8D: early_inliner(function*) (ipa-inline.cc:3038)
==4816==    by 0x1289CEA: execute_one_pass(opt_pass*) (passes.cc:2638)
==4816==    by 0x128A5AF: execute_pass_list_1(opt_pass*) (passes.cc:2738)
==4816==    by 0x128A5E8: execute_pass_list(function*, opt_pass*)
(passes.cc:2749)
==4816==    by 0x128AF04: do_per_function_toporder(void (*)(function*, void*),
void*) [clone .part.0] (passes.cc:1774)
==4816==    by 0x128B0FE: do_per_function_toporder (passes.cc:1741)
==4816==    by 0x128B0FE: execute_ipa_pass_list(opt_pass*) (passes.cc:3083)
==4816==    by 0xEB6645: ipa_passes (cgraphunit.cc:2160)
==4816==    by 0xEB6645: symbol_table::compile() [clone .part.0]
(cgraphunit.cc:2281)
==4816==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==4816== 
during GIMPLE pass: einline
testcase.c: In function 'foo':
testcase.c:13:3: internal compiler error: Segmentation fault
   13 |   bar ((V){}, (V){}, (V){}, (U){});
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0x13921df crash_signal
        /repo/gcc-trunk/gcc/toplev.cc:322
0xfce2b1 fold_convertible_p(tree_node const*, tree_node const*)
        /repo/gcc-trunk/gcc/fold-const.cc:2394
0x140eb40 force_value_to_type(tree_node*, tree_node*)
        /repo/gcc-trunk/gcc/tree-inline.cc:3457
0x1414b80 setup_one_parameter
        /repo/gcc-trunk/gcc/tree-inline.cc:3549
0x141fc8a initialize_inlined_parameters
        /repo/gcc-trunk/gcc/tree-inline.cc:3642
0x141fc8a expand_call_inline
        /repo/gcc-trunk/gcc/tree-inline.cc:5017
0x1422336 gimple_expand_calls_inline
        /repo/gcc-trunk/gcc/tree-inline.cc:5320
0x1422336 optimize_inline_calls(tree_node*)
        /repo/gcc-trunk/gcc/tree-inline.cc:5492
0x239fe8d early_inliner(function*)
        /repo/gcc-trunk/gcc/ipa-inline.cc:3038
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-7969-20220402191603-gbe07535d0f4-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-7969-20220402191603-gbe07535d0f4-checking-yes-rtl-df-extra-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.0.1 20220401 (experimental) (GCC)

Reply via email to