[Bug d/119139] Regression with struct invariants
ibuclaw at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Mar 6 15:10:50 GMT 2025
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119139
--- Comment #2 from Iain Buclaw <ibuclaw at gcc dot gnu.org> ---
Both gdc-11 and gdc-12 seem to produce the same tree structures from initial
dump.
```
struct toString ()
{
return <retval> = {.length=1, .ptr="1"};
}
void __invariant1 (const struct B & this)
{
return;
}
struct str (struct B & this)
{
void __returnLabel = <<< error >>>;
const struct __result;
__invariant ((struct B *) this);
if (this->n == 0)
{
__result = {.length=1, .ptr="0"};
goto __returnLabel;
}
__result = toString ();
goto __returnLabel;
__returnLabel:;
__invariant ((struct B *) this);
return <retval> = __result;
}
void __invariant (const struct B & this)
{
__invariant1 ((const struct B *) this);
}
int main ()
{
struct B b;
b = {.n=2};
str (&b);
return <retval> = 0;
}
```
More information about the Gcc-bugs
mailing list