internal compiler error: SSA corruption

Bug #1899114 reported by Jesse
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gcc-10 (Ubuntu)
Fix Released
Undecided
Unassigned
Focal
Fix Released
Undecided
Unassigned
gcc-snapshot (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Ubuntu version: 20.04.1 LTS
GCC version: gcc-10 (Ubuntu 10.2.0-5ubuntu1~20.04) 10.2.0
Minimal preprocessed source code to reproduce:

```c
a() {
  int b;
  __sigsetjmp();
  for (;;) {
    if (b)
      b = c();
    d();
  }
}
```

Command to reproduce: `gcc-10 -O3 -c rofl.c` gives the following error:

```
rofl.c:1:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
    1 | a() {
      | ^
rofl.c: In function ‘a’:
rofl.c:3:3: warning: implicit declaration of function ‘__sigsetjmp’ [-Wimplicit-function-declaration]
    3 | __sigsetjmp();
      | ^~~~~~~~~~~
rofl.c:6:11: warning: implicit declaration of function ‘c’ [-Wimplicit-function-declaration]
    6 | b = c();
      | ^
rofl.c:7:5: warning: implicit declaration of function ‘d’ [-Wimplicit-function-declaration]
    7 | d();
      | ^

Unable to coalesce ssa_names 2 and 4 which are marked as MUST COALESCE.
b_2(ab) and b_4(ab)
during RTL pass: expand
rofl.c:1:1: internal compiler error: SSA corruption
    1 | a() {
      | ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-10/README.Bugs> for instructions.
```

I tried reproduce with a recent snapshot. Since gcc-snapshot in focal is actually older than gcc-10, I tried it under groovy instead. And indeed, I was able to reproduce in groovy's gcc-snapshot ( 11.0.0 20200917 (experimental) [master revision c12facd2288:cb0617a790f:9fcedcc39153cb3cfa08ebab20aef6cdfb9ed609]) using a slightly different repro:

```c
a;
b() {
  int c, d;
  __sigsetjmp();
  for (; a;)
    for (; d;) {
      if (c)
        c = e();
      f();
    }
}
```

This file, when compiled with gcc-snapshot, leads to the following output:

```
rofl11.c:1:1: warning: data definition has no type or storage class
    1 | a;
      | ^
rofl11.c:1:1: warning: type defaults to 'int' in declaration of 'a' [-Wimplicit-int]
rofl11.c:2:1: warning: return type defaults to 'int' [-Wimplicit-int]
    2 | b() {
      | ^
rofl11.c: In function 'b':
rofl11.c:4:3: warning: implicit declaration of function '__sigsetjmp' [-Wimplicit-function-declaration]
    4 | __sigsetjmp();
      | ^~~~~~~~~~~
rofl11.c:8:13: warning: implicit declaration of function 'e' [-Wimplicit-function-declaration]
    8 | c = e();
      | ^
rofl11.c:9:7: warning: implicit declaration of function 'f' [-Wimplicit-function-declaration]
    9 | f();
      | ^

Unable to coalesce ssa_names 3 and 4 which are marked as MUST COALESCE.
c_3(ab) and c_4(ab)
during RTL pass: expand
rofl11.c:2:1: internal compiler error: SSA corruption
    2 | b() {
      | ^
0x185ffa7 internal_error(char const*, ...)
 ???:0
0xe92b7d coalesce_ssa_name(_var_map*)
 ???:0
0xe33007 rewrite_out_of_ssa(ssaexpand*)
 ???:0
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-snapshot/README.Bugs> for instructions.
```

Revision history for this message
Matthias Klose (doko) wrote :

confirmed, and fixed in focal. will be updated when we update gcc-10 in focal again.

Changed in gcc-10 (Ubuntu Focal):
status: New → Triaged
Changed in gcc-10 (Ubuntu):
status: New → Fix Released
Revision history for this message
Jesse (sbjesse) wrote :

Notice my second repro triggers the same error message in both gcc-10 and gcc-snapshot in groovy. Can you confirm those are fixed as well? I haven't used launchpad much in the last 8 years, I can't figure out how to also tag gcc-10 (groovy) and gcc-snapshot (groovy).

Revision history for this message
Jesse (sbjesse) wrote :

hmmm, I really want to highlight gcc-snapshot (groovy) but can't figure out how to change "focal" to "groovy"

no longer affects: gcc-snapshot (Ubuntu Focal)
Revision history for this message
Jesse (sbjesse) wrote :

I think this still affects package GCC-10 on both focal and groovy. Specifically the second repro posted above still crashes GCC. I'm repeating it here for clarity:

```
a;
b() {
  int c, d;
  __sigsetjmp();
  for (; a;)
    for (; d;) {
      if (c)
        c = e();
      f();
    }
}

```

putting the repro into `/tmp/c.c` and running `gcc-10 -O3 -c /tmp/c.c` triggers the bug:

```
c.c:1:1: warning: data definition has no type or storage class
    1 | a;
      | ^
c.c:1:1: warning: type defaults to 'int' in declaration of 'a' [-Wimplicit-int]
c.c:2:1: warning: return type defaults to 'int' [-Wimplicit-int]
    2 | b() {
      | ^
c.c: In function 'b':
c.c:4:3: warning: implicit declaration of function '__sigsetjmp' [-Wimplicit-function-declaration]
    4 | __sigsetjmp();
      | ^~~~~~~~~~~
c.c:8:13: warning: implicit declaration of function 'e' [-Wimplicit-function-declaration]
    8 | c = e();
      | ^
c.c:9:7: warning: implicit declaration of function 'f' [-Wimplicit-function-declaration]
    9 | f();
      | ^

Unable to coalesce ssa_names 3 and 4 which are marked as MUST COALESCE.
c_3(ab) and c_4(ab)
during RTL pass: expand
c.c:2:1: internal compiler error: SSA corruption
    2 | b() {
      | ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-10/README.Bugs> for instructions.

```

I tried the same repro on hirsute today and cannot reproduce the error.

Revision history for this message
Matthias Klose (doko) wrote :

> I tried the same repro on hirsute today and cannot reproduce the error.

closing

Changed in gcc-snapshot (Ubuntu):
status: New → Fix Released
Changed in gcc-10 (Ubuntu Focal):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.