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

            Bug ID: 115129
           Summary: [12/13/14/15 regression] ICE on recursive realloc call
                    with LTO
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sjames at gcc dot gnu.org
  Target Milestone: ---

Working on reducing something else but noticed this in the process.

url.i:
```
struct growable main_dest;
void* realloc();

struct growable {
  char base;
} append_string(struct growable *dest) {
  struct growable G_ = *dest;
  long DR_needed_size;
  while (DR_needed_size)
    realloc(G_);
}
int main() { append_string(&main_dest); }
```

xmalloc.i:
```
void *realloc(void *p, unsigned long s) { realloc(p, s); }
```

```
$ gcc url.i xmalloc.i -flto -O2
[...]
during GIMPLE pass: fre
url.i: In function ‘main’:
url.i:12:5: internal compiler error: in execute_todo, at passes.cc:2138
   12 | int main() { append_string(&main_dest); }
      |     ^
0x55b08ec670be execute_todo
        /usr/src/debug/sys-devel/gcc-15.0.9999/gcc-15.0.9999/gcc/passes.cc:2138
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://bugs.gentoo.org/> for instructions.
lto-wrapper: fatal error: gcc returned 1 exit status
compilation terminated.
/usr/lib/gcc/x86_64-pc-linux-gnu/15/../../../../x86_64-pc-linux-gnu/bin/ld:
error: lto-wrapper failed
collect2: error: ld returned 1 exit status
```

Reply via email to