[Bug d/119139] [12/13/14/15 regression] Regression with struct invariants
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Mar 11 19:29:12 GMT 2025
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119139
--- Comment #12 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Iain Buclaw
<ibuclaw@gcc.gnu.org>:
https://gcc.gnu.org/g:8d8eb5327f44472e8769807a6e632e2e0d445bb9
commit r12-10988-g8d8eb5327f44472e8769807a6e632e2e0d445bb9
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date: Tue Mar 11 17:56:18 2025 +0100
d: Fix regression returning from function with invariants [PR119139]
An optimization was added in GDC-12 which sets the TREE_READONLY flag on
all local variables with the storage class `const' assigned. For some
reason, const is also being added by the front-end to `__result'
variables in non-virtual functions, which ends up getting wrong code by
the gimplify pass promoting the local to static storage.
A bug has been raised upstream, as this looks like an error in the AST.
For now, turn off setting TREE_READONLY on all result variables.
PR d/119139
gcc/d/ChangeLog:
* decl.cc (get_symbol_decl): Don't set TREE_READONLY for __result
declarations.
gcc/testsuite/ChangeLog:
* gdc.dg/pr119139.d: New test.
(cherry picked from commit 81582ca6cb692098c1bda7995aec46c6cbfbfcb3)
More information about the Gcc-bugs
mailing list