public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/113976] [11/12/13/14 Regression] explicit instantiation of const variable template following implicit instantiation is assembled in .rodata instead of .bss since r8-2857-g2ec399d8a6c9c2 Date: Mon, 19 Feb 2024 17:30:11 +0000 [thread overview] Message-ID: <bug-113976-4-QnF9QlwnNo@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-113976-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113976 --- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> --- E.g. --- gcc/cp/decl.cc.jj 2024-02-15 09:51:34.460065992 +0100 +++ gcc/cp/decl.cc 2024-02-19 18:20:23.423410659 +0100 @@ -15263,7 +15263,14 @@ grokdeclarator (const cp_declarator *dec /* Record constancy and volatility on the DECL itself . There's no need to do this when processing a template; we'll do this for the instantiated declaration based on the type of DECL. */ - if (!processing_template_decl) + if (!processing_template_decl + /* Don't do it for instantiated variable templates either, + cp_apply_type_quals_to_decl should have been called on it + already and might have have been overridden in cp_finish_decl + if initializer needs runtime initialization. */ + && (!VAR_P (decl) + || DECL_LANG_SPECIFIC (decl) == NULL + || !DECL_USE_TEMPLATE (decl))) cp_apply_type_quals_to_decl (type_quals, decl); return decl; fixes it, but it is just a random shot in the dark. I think we want to differentiate between freshly created VAR_DECL from the grokdeclarator vs. existing VAR_DECL grokdeclarator just looked up.
next prev parent reply other threads:[~2024-02-19 17:30 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-02-17 21:17 [Bug c++/113976] New: explicit instantiation of const variable template following implicit instantiation is assembled in .rodata instead of .bss tamiko at gentoo dot org 2024-02-17 21:29 ` [Bug c++/113976] [11/12/13/14 Regression] " pinskia at gcc dot gnu.org 2024-02-18 6:49 ` sjames at gcc dot gnu.org 2024-02-18 8:03 ` tamiko at gentoo dot org 2024-02-18 18:06 ` [Bug c++/113976] [11/12/13/14 Regression] explicit instantiation of const variable template following implicit instantiation is assembled in .rodata instead of .bss since r8-2857-g2ec399d8a6c9c2 law at gcc dot gnu.org 2024-02-18 18:09 ` pinskia at gcc dot gnu.org 2024-02-18 18:39 ` jakub at gcc dot gnu.org 2024-02-19 8:10 ` rguenth at gcc dot gnu.org 2024-02-19 16:00 ` jakub at gcc dot gnu.org 2024-02-19 16:58 ` jakub at gcc dot gnu.org 2024-02-19 17:30 ` jakub at gcc dot gnu.org [this message] 2024-02-19 17:49 ` jakub at gcc dot gnu.org 2024-02-19 18:15 ` ppalka at gcc dot gnu.org 2024-02-28 22:22 ` cvs-commit at gcc dot gnu.org 2024-03-01 14:38 ` [Bug c++/113976] [11/12/13 " jakub at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-113976-4-QnF9QlwnNo@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).