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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-8 branch has been updated by Jakub Jelinek
<ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:a9e9ff7b8a4d10ccf54dd4a641dd55c1b1645e17

commit r8-10111-ga9e9ff7b8a4d10ccf54dd4a641dd55c1b1645e17
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Thu Feb 27 10:45:30 2020 +0100

    gimplify: Don't optimize register const vars to static [PR93949]

    The following testcase is rejected, while it was accepted in 3.4 and
earlier
    (before tree-ssa merge).
    The problem is that we decide to promote the const variable to TREE_STATIC,
    but TREE_STATIC DECL_REGISTER VAR_DECLs may only be the global register
vars
    and so assemble_variable/make_decl_rtl diagnoses it.

    Either we do what the following patch does, where we could consider
    register as a hint the user doesn't want such optimization, because if
    something is forced static, it is not "register" anymore and register
static
    is not valid in C either, or we could clear DECL_REGISTER instead, but
would
    still need to punt at least on DECL_HARD_REGISTER cases.

    2020-02-27  Jakub Jelinek  <ja...@redhat.com>

        PR c/93949
        * gimplify.c (gimplify_init_constructor): Don't promote readonly
        DECL_REGISTER variables to TREE_STATIC.

        * gcc.c-torture/compile/pr93949.c: New test.

Reply via email to