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

            Bug ID: 107336
           Summary: [10/11 regression] ICE segfault expand_expr_real_1 on
                    sparc-sun-solaris2.11 with -m32 -mcpu=niagara4 -O3
           Product: gcc
           Version: 10.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: andrew at ishiboo dot com
  Target Milestone: ---

Created attachment 53736
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53736&action=edit
GCC 10 & 11 pre-processed source files, compressed because they are 2MB each

The ICE segfault happens when building google-benchmark 1.6.1 on
sparc-sun-solaris2.11 in 32-bit mode. I've narrowed down the command line to:

g++ -m32 -mcpu=niagara4 -O3 -c -o /dev/null output_test_helper-preprocessed.cc

  - Building -m64, the ICE does not happen
  - Building without -mcpu=niagara4, the ICE does not happen
  - Building with -O or -O2, the ICE does not happen
  - GCC 9.4.0 does not ICE
  - GCC 10.4.0 triggers ICE during RTL pass: expand
  - GCC 11.3.0 triggers ICE during GIMPLE pass: isel
  - GCC 12.1.0 does not ICE

In GCC 10.4.0, the ICE occurs here:

    during RTL pass: expand
    In file included from /usr/lib/gcc-10.4/include/c++/10.4.0/random:51,
                     from output_test_helper.cc:7:
    /usr/lib/gcc-10.4/include/c++/10.4.0/bits/random.tcc: In member function
'void std::mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u,
__d, __s, __b, __t, __c, __l, __f>::_M_gen_rand() [with _UIntType = unsigned
int; unsigned int __w = 32; unsigned int __n = 624; unsigned int __m = 397;
unsigned int __r = 31; _UIntType __a = 2567483615; unsigned int __u = 11;
_UIntType __d = 4294967295; unsigned int __s = 7; _UIntType __b = 2636928640;
unsigned int __t = 15; _UIntType __c = 4022730752; unsigned int __l = 18;
_UIntType __f = 1812433253]':
    /usr/lib/gcc-10.4/include/c++/10.4.0/bits/random.tcc:405:14: internal
compiler error: Segmentation Fault
    0x162a8cf crash_signal
            ../../gcc/toplev.c:328
    0x103ce38 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
            ../../gcc/expr.c:10078
    0x10353af expand_expr_real(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
            ../../gcc/expr.c:8366
    0x102a24f store_expr(tree_node*, rtx_def*, int, bool, bool)
            ../../gcc/expr.c:5757
    0x1029003 expand_assignment(tree_node*, tree_node*, bool)
            ../../gcc/expr.c:5516
    0xe373f7 expand_gimple_stmt_1
            ../../gcc/cfgexpand.c:3784
    0xe3791f expand_gimple_stmt
            ../../gcc/cfgexpand.c:3880
    0xe40a17 expand_gimple_basic_block
            ../../gcc/cfgexpand.c:5929
    0xe42a23 execute
            ../../gcc/cfgexpand.c:6584

Using the same command line with GCC 11.3.0, the ICE still occurs, but changes
to become:

    during GIMPLE pass: isel
    In file included from /usr/lib/gcc-11.3/include/c++/11.3.0/random:51,
                     from output_test_helper.cc:7:
    /usr/lib/gcc-11.3/include/c++/11.3.0/bits/random.tcc: In member function
'void std::mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u,
__d, __s, __b, __t, __c, __l, __f>::_M_gen_rand() [with _UIntType = unsigned
int; unsigned int __w = 32; unsigned int __n = 624; unsigned int __m = 397;
unsigned int __r = 31; _UIntType __a = 2567483615; unsigned int __u = 11;
_UIntType __d = 4294967295; unsigned int __s = 7; _UIntType __b = 2636928640;
unsigned int __t = 15; _UIntType __c = 4022730752; unsigned int __l = 18;
_UIntType __f = 1812433253]':
    /usr/lib/gcc-11.3/include/c++/11.3.0/bits/random.tcc:394:5: internal
compiler error: in gimple_expand_vec_cond_expr, at gimple-isel.cc:270
    0x1be84ff gimple_expand_vec_cond_expr
            ../../gcc/gimple-isel.cc:267
    0x1be8673 gimple_expand_vec_exprs
            ../../gcc/gimple-isel.cc:297
    0x1be8937 execute
            ../../gcc/gimple-isel.cc:350

No ICE occurs with GCC 12.1.0.

If the underlying issue was fixed (accidentally or not), are there patches that
can be applied to 10/11?

Reply via email to