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

            Bug ID: 116073
           Summary: [15 regression] invalid rtl sharing compiling
                    compiling FileSystem.mod
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ro at gcc dot gnu.org
                CC: gaius at gcc dot gnu.org, law at gcc dot gnu.org
  Target Milestone: ---
            Target: sparc*-sun-solaris2.11

Between 20240719 (a8e61cd71f0cda04d583722ca4c66301358b01e1) and 20240723
(2861eb34e30973cb991a7964af7cfeae014a98b0),
Solaris/SPARC bootstrap broke compiling libgm2:

/var/gcc/regression/master/11.4-gcc-gas/build/./gcc/gm2
-B/var/gcc/regression/master/11.4-gcc-gas/build/./gcc/ -c -g -O2 -g -O2
-fm2-pathname=m2pim -I../libm2pim -fm2-pathname=m2log
-I/vol/gcc/src/hg/master/local/gcc/m2/gm2-libs-log -fm2-pathname=m2pim
-I/vol/gcc/src/hg/master/local/gcc/m2/gm2-libs -fm2-pathname=m2iso
-I/vol/gcc/src/hg/master/local/gcc/m2/gm2-libs-iso -Wcase-enum -Wreturn-type
-fcase -fm2-prefix=m2log
/vol/gcc/src/hg/master/local/libgm2/libm2log/../../gcc/m2/gm2-libs-log/FileSystem.mod
 -fPIC -DPIC -o .libs/FileSystem.o
/vol/gcc/src/hg/master/local/libgm2/libm2log/../../gcc/m2/gm2-libs-log/FileSystem.mod:
In function ‘doModeChange.part.0’:
/vol/gcc/src/hg/master/local/libgm2/libm2log/../../gcc/m2/gm2-libs-log/FileSystem.mod:448:1:
error: invalid rtl sharing found in the insn
  448 | END doModeChange ;
      | ^~~
(insn 91 90 67 9 (set (reg:SI 152 [ _T279_15+4 ])
        (mem:SI (plus:SI (reg/v/f:SI 126 [ f ])
                (const_int 28 [0x1c])) [2 f_1(D)->lowpos+0 S4 A32]))
"/vol/gcc/src/hg/master/local/libgm2/libm2log/../../gcc/m2/gm2-libs-log/FileSystem.mod":444:27
116 {*movsi_insn}
     (nil))
/vol/gcc/src/hg/master/local/libgm2/libm2log/../../gcc/m2/gm2-libs-log/FileSystem.mod:448:1:
error: shared rtx
(mem:SI (plus:SI (reg/v/f:SI 126 [ f ])
        (const_int 28 [0x1c])) [2 f_1(D)->lowpos+0 S4 A32])
during RTL pass: subreg3
/vol/gcc/src/hg/master/local/libgm2/libm2log/../../gcc/m2/gm2-libs-log/FileSystem.mod:448:1:
internal compiler error: internal consistency failure
0x1e122cf internal_error(char const*, ...)
        /vol/gcc/src/hg/master/local/gcc/diagnostic-global-context.cc:491
0x99c78b verify_rtx_sharing
        /vol/gcc/src/hg/master/local/gcc/emit-rtl.cc:3046
0x99c5d7 verify_rtx_sharing
        /vol/gcc/src/hg/master/local/gcc/emit-rtl.cc:3061
0x99c7b3 verify_insn_sharing
        /vol/gcc/src/hg/master/local/gcc/emit-rtl.cc:3131
0x9a23ab verify_rtl_sharing()
        /vol/gcc/src/hg/master/local/gcc/emit-rtl.cc:3154
0xd99e3b execute_function_todo
        /vol/gcc/src/hg/master/local/gcc/passes.cc:2110
0xd9a34b do_per_function
        /vol/gcc/src/hg/master/local/gcc/passes.cc:1688
0xd9a503 execute_todo
        /vol/gcc/src/hg/master/local/gcc/passes.cc:2143

A reghunt proved to be pretty ugly because at some point

commit 88d16194d0c8a6bdc2896c8944bfbf3e6038c9d2
Author: Jeff Law <j...@ventanamicro.com>
Date:   Mon Jul 22 08:45:10 2024 -0600

    [NFC][PR rtl-optimization/115877] Avoid setting irrelevant bit groups as
live in ext-dce

The libgm2 ICE was traded for one in libgcc:

/var/gcc/reghunt/master/libgcc/libgcc2.c: In function ‘__gcc_bcmp’:
/var/gcc/reghunt/master/libgcc/libgcc2.c:2970:1: internal compiler error: in
check_probability, at basic-block.h:563
 2970 | }
      | ^

The latter got fixed by one of the later ext-dce.cc patches, but still it's 
hard to tell which patch caused the libgm2 failure.

As an experiment, I locally reverted ext-dce.cc to

commit 7c3287f3613210d4f98c8095bc739bea6582bfbb
Author: Andrew Pinski <quic_apin...@quicinc.com>
Date:   Tue Jul 16 09:53:20 2024 -0700

    Add debug counter for ext_dce

and the ICE was gone.

Reply via email to