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

            Bug ID: 121211
           Summary: ICE: in make_decl_rtl, at varasm.cc:145 with simd
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: iamanonymous.cs at gmail dot com
  Target Milestone: ---

When compiling this program with -fopenmp, GCC crashes:
```
struct {
  int a;
} b[];
int c, d;
void e() {
#pragma omp simd aligned(b)
  for (d = 0; d < b[c].a; d += 4)
    ;
}
```

Complier Explorer: https://godbolt.org/z/eoKrhcdK4

The full stack dump:
```
mutant.c:3:5: warning: array 'b' assumed to have one element
    3 |   } b[];
      |     ^
during RTL pass: expand
mutant.c: In function 'e':
mutant.c:7:25: internal compiler error: in make_decl_rtl, at varasm.cc:1459
    7 |     for (d = 0; d < b[c].a; d += 4)
      |                     ~~~~^~
0x5554b38 internal_error(char const*, ...)
        ../../gcc/gcc/diagnostic-global-context.cc:517
0x54d2d0a fancy_abort(char const*, int, char const*)
        ../../gcc/gcc/diagnostic.cc:1803
0x2a50b22 make_decl_rtl(tree_node*)
        ../../gcc/gcc/varasm.cc:1459
0x169b3ea expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        ../../gcc/gcc/expr.cc:11487
0x168b75c expand_expr_real(tree_node*, rtx_def*, machine_mode, expand_modifier,
rtx_def**, bool)
        ../../gcc/gcc/expr.cc:9523
0x16a1063 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        ../../gcc/gcc/expr.cc:12125
0x168b75c expand_expr_real(tree_node*, rtx_def*, machine_mode, expand_modifier,
rtx_def**, bool)
        ../../gcc/gcc/expr.cc:9523
0x16777b7 store_expr(tree_node*, rtx_def*, int, bool, bool)
        ../../gcc/gcc/expr.cc:6762
0x1674a3c expand_assignment(tree_node*, tree_node*, bool)
        ../../gcc/gcc/expr.cc:6483
0x1364c65 expand_gimple_stmt_1
        ../../gcc/gcc/cfgexpand.cc:4330
0x13652c0 expand_gimple_stmt
        ../../gcc/gcc/cfgexpand.cc:4411
0x1373f58 expand_gimple_basic_block
        ../../gcc/gcc/cfgexpand.cc:6472
0x13788bf execute
        ../../gcc/gcc/cfgexpand.cc:7223
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.
```

Reply via email to