[Bug d/119139] Regression with struct invariants

2025-03-09 Thread ibuclaw at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119139 Iain Buclaw changed: What|Removed |Added URL||https://github.com/dlang/dm

[Bug d/119139] Regression with struct invariants

2025-03-06 Thread ibuclaw at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119139 --- Comment #7 from Iain Buclaw --- >From http://www.dsource.org/projects/dmd/changeset/259 The first setting of `const` to the result variable looks fine, as that's against the parameter in the `out(result)` function, the result cannot be chan

[Bug d/119139] Regression with struct invariants

2025-03-06 Thread ibuclaw at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119139 --- Comment #6 from Iain Buclaw --- https://github.com/dlang/dmd/blob/4661fec6b792dcb22d66776fcdbe62ecb59667d1/compiler/src/dmd/funcsem.d#L2420-L2421 Introduced by. https://issues.dlang.org/show_bug.cgi?id=3390

[Bug d/119139] Regression with struct invariants

2025-03-06 Thread ibuclaw at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119139 --- Comment #5 from Iain Buclaw --- Looking at where TREE_READONLY gets set in the front-end, it's likely introduced by PR110514. It does look as though the result variable incorrectly has `const` tagged against it though.

[Bug d/119139] Regression with struct invariants

2025-03-06 Thread ibuclaw at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119139 --- Comment #4 from Iain Buclaw --- The D front-end doesn't set TREE_STATIC on the `__result` variable, it's gcc/gimplify.cc at this location: ``` /* If a const aggregate variable is being initialized, then it should never be a lose to promo

[Bug d/119139] Regression with struct invariants

2025-03-06 Thread ibuclaw at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119139 --- Comment #3 from Iain Buclaw --- 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 __res

[Bug d/119139] Regression with struct invariants

2025-03-06 Thread ibuclaw at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119139 --- Comment #2 from Iain Buclaw --- Both gdc-11 and gdc-12 seem to produce the same tree structures from initial dump. ``` struct toString () { return = {.length=1, .ptr="1"}; } void __invariant1 (const struct B & this) { return; } st

[Bug d/119139] Regression with struct invariants

2025-03-06 Thread ibuclaw at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119139 Iain Buclaw changed: What|Removed |Added CC||ibuclaw at gcc dot gnu.org --- Comment #1