[Bug c++/33661] template methods forget explicit local register asm vars

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Apr 20 23:31:46 GMT 2021


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

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

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

commit r9-9412-gef5db37cc4e80b229502bea7d6e2daa95ad6f805
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Jan 28 16:13:11 2021 +0100

    c++: Fix up handling of register ... asm ("...") vars in templates
[PR33661, PR98847]

    As the testcase shows, for vars appearing in templates, we don't attach
    the asm spec string to the pattern decls, nor pass it back to
cp_finish_decl
    during instantiation.

    The following patch does that.

    2021-01-28  Jakub Jelinek  <jakub@redhat.com>

            PR c++/33661
            PR c++/98847
            * decl.c (cp_finish_decl): For register vars with asmspec in
templates
            call set_user_assembler_name and set DECL_HARD_REGISTER.
            * pt.c (tsubst_expr): When instantiating DECL_HARD_REGISTER vars,
            pass asmspec_tree to cp_finish_decl.

            * g++.target/i386/pr98847.C: New test.

    (cherry picked from commit cf93f94b3498f3925895fb0bbfd4b64232b9987a)


More information about the Gcc-bugs mailing list