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

--- Comment #3 from Iain Buclaw <ibuclaw at gcc dot gnu.org> ---
It's only in latter tree dump passes we see that in the "bad" code gen, the
`const struct __result` is in fact static data from gdc-12 onwards.

```
struct  str (struct B & this)
{
  static const struct  __result = {.length=1, .ptr="0"};
  //...
  <bb 4> :
  __result = toString ();

  //...
}
```

Compared with the working code gen.
```
struct  str (struct B & this)
{
  const struct  __result;
  //...
  <bb 3> :
  __result.length = 1;
  __result.ptr = "0";
  //...
  <bb 4> :
  __result = toString ();
  //...
}
```

Reply via email to