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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Iain Buclaw
<ibuc...@gcc.gnu.org>:

https://gcc.gnu.org/g:750526ee180ae2af66ee07db95c9787e8d86ed4b

commit r12-9747-g750526ee180ae2af66ee07db95c9787e8d86ed4b
Author: Iain Buclaw <ibuc...@gdcproject.org>
Date:   Sat Jul 1 23:32:53 2023 +0200

    d: Fix accesses of immutable arrays using constant index still bounds
checked

    Starts setting TREE_READONLY against specific kinds of VAR_DECLs, so
    that the middle-end/optimization passes can more aggressively constant
    fold D code that makes use of `immutable' or `const'.

            PR d/110514

    gcc/d/ChangeLog:

            * decl.cc (get_symbol_decl): Set TREE_READONLY on certain kinds of
            const and immutable variables.
            * expr.cc (ExprVisitor::visit (ArrayLiteralExp *)): Set
TREE_READONLY
            on immutable dynamic array literals.

    gcc/testsuite/ChangeLog:

            * gdc.dg/pr110514a.d: New test.
            * gdc.dg/pr110514b.d: New test.
            * gdc.dg/pr110514c.d: New test.
            * gdc.dg/pr110514d.d: New test.

    (cherry picked from commit 61b1c562f8c703bff045e91257120e42b7fae523)

Reply via email to