public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114013] New: [14 Regression] Specializations of var templates no longer emitted since r14-8987
@ 2024-02-20 16:35 jakub at gcc dot gnu.org
2024-02-20 16:36 ` [Bug c++/114013] " jakub at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-02-20 16:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114013
Bug ID: 114013
Summary: [14 Regression] Specializations of var templates no
longer emitted since r14-8987
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jakub at gcc dot gnu.org
Target Milestone: ---
struct S { int a, b; };
template <int N>
constexpr struct S var[16] = {};
template <>
constexpr inline struct S var<6>[8] = {
{ 1, 1 }, { 2, 0 }, { 3, 1 }, { 4, 0 },
{ 5, 1 }, { 6, 0 }, { 7, 1 }, { 8, 0 }
};
[[gnu::noipa]] void
foo (S)
{
}
template <int N>
void
bar (int x)
{
foo (var<N>[x]);
}
volatile int x;
int
main ()
{
bar <6> (x);
}
extracted from mesa no longer links starting with
r14-8987-gdd9d14f7d53de07beff06004922a2bff20ece671 (-O0 or -O2, doesn't
matter).
/usr/bin/ld: /tmp/cc4Mqq20.o: in function `void bar<6>(int)':
mesa.C:(.text._Z3barILi6EEvi[_Z3barILi6EEvi]+0x14): undefined reference to
`var<6>'
collect2: error: ld returned 1 exit status
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/114013] [14 Regression] Specializations of var templates no longer emitted since r14-8987
2024-02-20 16:35 [Bug c++/114013] New: [14 Regression] Specializations of var templates no longer emitted since r14-8987 jakub at gcc dot gnu.org
@ 2024-02-20 16:36 ` jakub at gcc dot gnu.org
2024-02-20 17:53 ` jakub at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-02-20 16:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114013
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2024-02-20
Target Milestone|--- |14.0
Priority|P3 |P1
CC| |jason at gcc dot gnu.org,
| |nshead at gcc dot gnu.org,
| |ppalka at gcc dot gnu.org
Status|UNCONFIRMED |NEW
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/114013] [14 Regression] Specializations of var templates no longer emitted since r14-8987
2024-02-20 16:35 [Bug c++/114013] New: [14 Regression] Specializations of var templates no longer emitted since r14-8987 jakub at gcc dot gnu.org
2024-02-20 16:36 ` [Bug c++/114013] " jakub at gcc dot gnu.org
@ 2024-02-20 17:53 ` jakub at gcc dot gnu.org
2024-02-20 17:54 ` jakub at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-02-20 17:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114013
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
s/16/8/, sorry for the leftover from earlier larger version.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/114013] [14 Regression] Specializations of var templates no longer emitted since r14-8987
2024-02-20 16:35 [Bug c++/114013] New: [14 Regression] Specializations of var templates no longer emitted since r14-8987 jakub at gcc dot gnu.org
2024-02-20 16:36 ` [Bug c++/114013] " jakub at gcc dot gnu.org
2024-02-20 17:53 ` jakub at gcc dot gnu.org
@ 2024-02-20 17:54 ` jakub at gcc dot gnu.org
2024-02-27 16:44 ` enrico.seiler+gccbugs at outlook dot com
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-02-20 17:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114013
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
And it behaves the same way even if there is
template <int N>
constexpr inline struct S var[8] = {};
instead.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/114013] [14 Regression] Specializations of var templates no longer emitted since r14-8987
2024-02-20 16:35 [Bug c++/114013] New: [14 Regression] Specializations of var templates no longer emitted since r14-8987 jakub at gcc dot gnu.org
` (2 preceding siblings ...)
2024-02-20 17:54 ` jakub at gcc dot gnu.org
@ 2024-02-27 16:44 ` enrico.seiler+gccbugs at outlook dot com
2024-02-28 0:26 ` cvs-commit at gcc dot gnu.org
2024-02-28 10:17 ` jakub at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: enrico.seiler+gccbugs at outlook dot com @ 2024-02-27 16:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114013
--- Comment #3 from Enrico Seiler <enrico.seiler+gccbugs at outlook dot com> ---
For -O0 and -O1, this also does not link:
template <int> int value;
template <> inline int value<1>;
void bar(int) { bar(value<1>); }
https://godbolt.org/z/Wxv7PE8ob
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/114013] [14 Regression] Specializations of var templates no longer emitted since r14-8987
2024-02-20 16:35 [Bug c++/114013] New: [14 Regression] Specializations of var templates no longer emitted since r14-8987 jakub at gcc dot gnu.org
` (3 preceding siblings ...)
2024-02-27 16:44 ` enrico.seiler+gccbugs at outlook dot com
@ 2024-02-28 0:26 ` cvs-commit at gcc dot gnu.org
2024-02-28 10:17 ` jakub at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-02-28 0:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114013
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Nathaniel Shead <nshead@gcc.gnu.org>:
https://gcc.gnu.org/g:615b62aada6cc42759e5c43e196dab6c524925d6
commit r14-9201-g615b62aada6cc42759e5c43e196dab6c524925d6
Author: Nathaniel Shead <nathanieloshead@gmail.com>
Date: Wed Feb 28 11:20:53 2024 +1100
c++: Revert deferring emission of inline variables [PR114013]
This is a (partial) reversion of r14-8987-gdd9d14f7d53 to return to
eagerly emitting inline variables to the middle-end when they are
declared. 'import_export_decl' will still continue to accept them, as
allowing this is a pure extension and doesn't seem to cause issues with
modules, but otherwise deferring the emission of inline variables
appears to cause issues on some targets and prevents some code using
inline variable templates from correctly linking.
There might be a more targetted way to support this, but due to the
complexity of handling linkage and emission I'd prefer to wait till
GCC 15 to explore our options.
PR c++/113970
PR c++/114013
gcc/cp/ChangeLog:
* decl.cc (make_rtl_for_nonlocal_decl): Don't defer inline
variables.
gcc/testsuite/ChangeLog:
* g++.dg/cpp1z/inline-var10.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/114013] [14 Regression] Specializations of var templates no longer emitted since r14-8987
2024-02-20 16:35 [Bug c++/114013] New: [14 Regression] Specializations of var templates no longer emitted since r14-8987 jakub at gcc dot gnu.org
` (4 preceding siblings ...)
2024-02-28 0:26 ` cvs-commit at gcc dot gnu.org
@ 2024-02-28 10:17 ` jakub at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-02-28 10:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114013
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-02-28 10:17 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-20 16:35 [Bug c++/114013] New: [14 Regression] Specializations of var templates no longer emitted since r14-8987 jakub at gcc dot gnu.org
2024-02-20 16:36 ` [Bug c++/114013] " jakub at gcc dot gnu.org
2024-02-20 17:53 ` jakub at gcc dot gnu.org
2024-02-20 17:54 ` jakub at gcc dot gnu.org
2024-02-27 16:44 ` enrico.seiler+gccbugs at outlook dot com
2024-02-28 0:26 ` cvs-commit at gcc dot gnu.org
2024-02-28 10:17 ` jakub at gcc dot gnu.org
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).