public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/115129] New: [12/13/14/15 regression] ICE on recursive realloc call with LTO
@ 2024-05-17  7:56 sjames at gcc dot gnu.org
  2024-05-17  8:03 ` [Bug lto/115129] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-05-17  7:56 UTC (permalink / raw)
  To: gcc-bugs

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
```

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug lto/115129] [12/13/14/15 regression] ICE on recursive realloc call with LTO
  2024-05-17  7:56 [Bug lto/115129] New: [12/13/14/15 regression] ICE on recursive realloc call with LTO sjames at gcc dot gnu.org
@ 2024-05-17  8:03 ` rguenth at gcc dot gnu.org
  2024-05-17  8:08 ` rguenth at gcc dot gnu.org
  2024-06-20  9:15 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-05-17  8:03 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unknown                     |14.1.0
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1
   Target Milestone|---                         |12.4
   Last reconfirmed|                            |2024-05-17

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.

Setting value number of p_4 to 0B (changed)
Value numbering stmt = realloc (p_4, s_5(D));

...

  <bb 3> [local count: 8687547538]:
  __builtin_malloc (s_5(D));

but virtual operands are not updated.  Somewhere we fold this and break things
this way.  gimple_fold_builtin_realloc likely.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug lto/115129] [12/13/14/15 regression] ICE on recursive realloc call with LTO
  2024-05-17  7:56 [Bug lto/115129] New: [12/13/14/15 regression] ICE on recursive realloc call with LTO sjames at gcc dot gnu.org
  2024-05-17  8:03 ` [Bug lto/115129] " rguenth at gcc dot gnu.org
@ 2024-05-17  8:08 ` rguenth at gcc dot gnu.org
  2024-06-20  9:15 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-05-17  8:08 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hubicka at gcc dot gnu.org

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Ah, because that realloc definition makes realloc CONST, but the replacement
builtin is not.

Honza, I know we still have that loop pattern detection bug detecting
memcpy as memcpy.  What's our (IPA?) strategy in these kind of situations?
Should we avoid messing with builtin implementation attributes?

We can of course sanity-check at folding time and leave realloc w/o virtual
operands alone, but ...

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug lto/115129] [12/13/14/15 regression] ICE on recursive realloc call with LTO
  2024-05-17  7:56 [Bug lto/115129] New: [12/13/14/15 regression] ICE on recursive realloc call with LTO sjames at gcc dot gnu.org
  2024-05-17  8:03 ` [Bug lto/115129] " rguenth at gcc dot gnu.org
  2024-05-17  8:08 ` rguenth at gcc dot gnu.org
@ 2024-06-20  9:15 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-06-20  9:15 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|12.4                        |12.5

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 12.4 is being released, retargeting bugs to GCC 12.5.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-06-20  9:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-17  7:56 [Bug lto/115129] New: [12/13/14/15 regression] ICE on recursive realloc call with LTO sjames at gcc dot gnu.org
2024-05-17  8:03 ` [Bug lto/115129] " rguenth at gcc dot gnu.org
2024-05-17  8:08 ` rguenth at gcc dot gnu.org
2024-06-20  9:15 ` rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).