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

            Bug ID: 128236
           Summary: [14/15/16/17 Regression] ICE: SSA corruption with
                    setjmp after forwprop moves complex-load REALPART_EXPR
                    def of abnormal SSA name
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lzy20000419 at outlook dot com
  Target Milestone: ---

This was split out of PR125502 comment 10, as requested in comment 11.

```c
#include <setjmp.h>
jmp_buf jb;
void use (double);
void g (_Complex double *p)
{
  double r = 0;
  _Complex double c = *p;
  setjmp (jb);
  use (r);
  r = __real__ c;
  use (r);
}
```

`gcc -O1 -c t.c` (also -O2, -O3) on trunk:

```
Unable to coalesce ssa_names 2 and 9 which are marked as MUST COALESCE.
r_2(ab) and  r_9(ab)
during RTL pass: expand
t.c: In function 'g':
t.c:4:6: internal compiler error: SSA corruption
0x13d8324 coalesce_ssa_name(_var_map*)
0x135c664 rewrite_out_of_ssa(ssaexpand*)
```

- -O0 and `-O1 -fno-tree-forwprop` compile fine.
- `__imag__ c` instead of `__real__ c` ICEs the same way.
- Works with 4.8.5 and 4.9.4; ICEs with 5.1 through 16.2 and trunk (17.0.0
20261027).
- trunk: https://godbolt.org/z/qPb3GjGqq (-O1), https://godbolt.org/z/74q7jsPr3
(-O1 -fno-tree-forwprop)

Reply via email to