public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/28017] lack of guard variables for explicitly instantiated template static data
[not found] <bug-28017-4@http.gcc.gnu.org/bugzilla/>
@ 2024-04-03 23:13 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-03 23:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=28017
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=80320
Known to fail| |
--- Comment #14 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I think this and PR 80320 both have the same underlying issue.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/28017] lack of guard variables for explicitly instantiated template static data
2006-06-13 19:13 [Bug c++/28017] New: " hhinnant at apple dot com
` (11 preceding siblings ...)
2006-06-21 5:08 ` pinskia at gcc dot gnu dot org
@ 2009-01-27 17:26 ` bkoz at gcc dot gnu dot org
12 siblings, 0 replies; 16+ messages in thread
From: bkoz at gcc dot gnu dot org @ 2009-01-27 17:26 UTC (permalink / raw)
To: gcc-bugs
------- Comment #13 from bkoz at gcc dot gnu dot org 2009-01-27 17:26 -------
*** Bug 25956 has been marked as a duplicate of this bug. ***
--
bkoz at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jkp at kirkconsulting dot co
| |dot uk
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28017
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/28017] lack of guard variables for explicitly instantiated template static data
2006-06-13 19:13 [Bug c++/28017] New: " hhinnant at apple dot com
` (10 preceding siblings ...)
2006-06-21 5:05 ` pinskia at gcc dot gnu dot org
@ 2006-06-21 5:08 ` pinskia at gcc dot gnu dot org
2009-01-27 17:26 ` bkoz at gcc dot gnu dot org
12 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-06-21 5:08 UTC (permalink / raw)
To: gcc-bugs
------- Comment #12 from pinskia at gcc dot gnu dot org 2006-06-21 05:05 -------
-fno-weak worked in 3.0.4 and below, though I don't know if it was really
working so I am not marking this as a regression.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail| |3.2.3 3.4.0 4.0.0 4.1.0
| |4.2.0
Target Milestone|4.0.4 |---
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28017
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/28017] lack of guard variables for explicitly instantiated template static data
2006-06-13 19:13 [Bug c++/28017] New: " hhinnant at apple dot com
` (9 preceding siblings ...)
2006-06-19 18:22 ` hhinnant at apple dot com
@ 2006-06-21 5:05 ` pinskia at gcc dot gnu dot org
2006-06-21 5:08 ` pinskia at gcc dot gnu dot org
2009-01-27 17:26 ` bkoz at gcc dot gnu dot org
12 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-06-21 5:05 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from pinskia at gcc dot gnu dot org 2006-06-21 04:50 -------
Actually I take that back, it is also a problem with targets that don't have
weak symbols too.
On x86_64-linux-gnu with the additional flag of -fno-weak:
pc64:~> g++ test.cc test1.cc -fno-weak
pc64:~> ./a.out
new: mString has value 0x502010
new: mString has value 0x502030
delete: mString has value 0x502030
delete: mString has value 0x502030
*** glibc detected *** double free or corruption (fasttop): 0x0000000000502030
***
Abort
So the new part of the test should be just shrunk back to testing
DECL_EXPLICIT_INSTANTIATION instead of the other parts too.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
GCC target triplet|*-darwin |non weak
Target Milestone|--- |4.0.4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28017
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/28017] lack of guard variables for explicitly instantiated template static data
2006-06-13 19:13 [Bug c++/28017] New: " hhinnant at apple dot com
` (8 preceding siblings ...)
2006-06-13 23:28 ` hhinnant at apple dot com
@ 2006-06-19 18:22 ` hhinnant at apple dot com
2006-06-21 5:05 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
12 siblings, 0 replies; 16+ messages in thread
From: hhinnant at apple dot com @ 2006-06-19 18:22 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from hhinnant at apple dot com 2006-06-19 18:11 -------
It turns out this still isn't quite right. Looks like we need:
#define NEEDS_GUARD_P(decl) (TREE_PUBLIC (decl) && (DECL_COMMON (decl) \
|| DECL_ONE_ONLY (decl) \
|| DECL_WEAK (decl) \
||
(TARGET_WEAK_NOT_IN_ARCHIVE_TOC \
&& DECL_LANG_SPECIFIC
(decl) \
&&
(DECL_EXPLICIT_INSTANTIATION (decl) \
||
DECL_TEMPLATE_SPECIALIZATION (decl)))))
The former solution was dereferencing a null pointer.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28017
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/28017] lack of guard variables for explicitly instantiated template static data
2006-06-13 19:13 [Bug c++/28017] New: " hhinnant at apple dot com
` (7 preceding siblings ...)
2006-06-13 22:02 ` pinskia at physics dot uc dot edu
@ 2006-06-13 23:28 ` hhinnant at apple dot com
2006-06-19 18:22 ` hhinnant at apple dot com
` (3 subsequent siblings)
12 siblings, 0 replies; 16+ messages in thread
From: hhinnant at apple dot com @ 2006-06-13 23:28 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from hhinnant at apple dot com 2006-06-13 22:02 -------
(In reply to comment #8)
Thanks. That not only makes sense to me now, but it passes the test. :-)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28017
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/28017] lack of guard variables for explicitly instantiated template static data
2006-06-13 19:13 [Bug c++/28017] New: " hhinnant at apple dot com
` (6 preceding siblings ...)
2006-06-13 21:47 ` hhinnant at apple dot com
@ 2006-06-13 22:02 ` pinskia at physics dot uc dot edu
2006-06-13 23:28 ` hhinnant at apple dot com
` (4 subsequent siblings)
12 siblings, 0 replies; 16+ messages in thread
From: pinskia at physics dot uc dot edu @ 2006-06-13 22:02 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from pinskia at physics dot uc dot edu 2006-06-13 21:47 -------
Subject: Re: lack of guard variables for explicitly instantiated template
static data
>
>
>
> ------- Comment #7 from hhinnant at apple dot com 2006-06-13 21:41 -------
> (In reply to comment #6)
> > Subject: Re: lack of guard variables for explicitly instantiated template
> > static data
> >
> > > #define NEEDS_GUARD_P(decl) (TREE_PUBLIC (decl) && (DECL_COMMON (decl) \
> > > || DECL_ONE_ONLY (decl) \
> > > || DECL_WEAK (decl) \
> > > ||
> > > (!TARGET_WEAK_NOT_IN_ARCHIVE_TOC \
> > > || (! DECL_EXPLICIT_INSTANTIATION (decl) \
> > > && ! DECL_TEMPLATE_SPECIALIZATION (decl)))))
> > >
> > > ?
> >
> > The latter.
>
> Thanks. But this doesn't pass the test case on darwin. I'm not familiar
> enough with the C++ FE to understand TARGET_WEAK_NOT_IN_ARCHIVE_TOC. Could you
> double check the above. The "!" in front of DECL_EXPLICIT_INSTANTIATION looks
> especially suspicious to me.
You want the opposite of that like:
(TARGET_WEAK_NOT_IN_ARCHIVE_TOC && (DECL_EXPLICIT_INSTANTIATION (decl) ||
DECL_TEMPLATE_SPECIALIZATION (decl)))
I was quoting the case when DECL_WEAK would be set on the decl.
TARGET_WEAK_NOT_IN_ARCHIVE_TOC is only defined to 1 for darwin.
-- Pinski
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28017
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Bug c++/28017] lack of guard variables for explicitly instantiated template static data
2006-06-13 21:47 ` hhinnant at apple dot com
@ 2006-06-13 21:47 ` Andrew Pinski
0 siblings, 0 replies; 16+ messages in thread
From: Andrew Pinski @ 2006-06-13 21:47 UTC (permalink / raw)
To: gcc-bugzilla; +Cc: gcc-bugs
>
>
>
> ------- Comment #7 from hhinnant at apple dot com 2006-06-13 21:41 -------
> (In reply to comment #6)
> > Subject: Re: lack of guard variables for explicitly instantiated template
> > static data
> >
> > > #define NEEDS_GUARD_P(decl) (TREE_PUBLIC (decl) && (DECL_COMMON (decl) \
> > > || DECL_ONE_ONLY (decl) \
> > > || DECL_WEAK (decl) \
> > > ||
> > > (!TARGET_WEAK_NOT_IN_ARCHIVE_TOC \
> > > || (! DECL_EXPLICIT_INSTANTIATION (decl) \
> > > && ! DECL_TEMPLATE_SPECIALIZATION (decl)))))
> > >
> > > ?
> >
> > The latter.
>
> Thanks. But this doesn't pass the test case on darwin. I'm not familiar
> enough with the C++ FE to understand TARGET_WEAK_NOT_IN_ARCHIVE_TOC. Could you
> double check the above. The "!" in front of DECL_EXPLICIT_INSTANTIATION looks
> especially suspicious to me.
You want the opposite of that like:
(TARGET_WEAK_NOT_IN_ARCHIVE_TOC && (DECL_EXPLICIT_INSTANTIATION (decl) || DECL_TEMPLATE_SPECIALIZATION (decl)))
I was quoting the case when DECL_WEAK would be set on the decl.
TARGET_WEAK_NOT_IN_ARCHIVE_TOC is only defined to 1 for darwin.
-- Pinski
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/28017] lack of guard variables for explicitly instantiated template static data
2006-06-13 19:13 [Bug c++/28017] New: " hhinnant at apple dot com
` (5 preceding siblings ...)
2006-06-13 21:41 ` pinskia at physics dot uc dot edu
@ 2006-06-13 21:47 ` hhinnant at apple dot com
2006-06-13 21:47 ` Andrew Pinski
2006-06-13 22:02 ` pinskia at physics dot uc dot edu
` (5 subsequent siblings)
12 siblings, 1 reply; 16+ messages in thread
From: hhinnant at apple dot com @ 2006-06-13 21:47 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from hhinnant at apple dot com 2006-06-13 21:41 -------
(In reply to comment #6)
> Subject: Re: lack of guard variables for explicitly instantiated template
> static data
>
> > #define NEEDS_GUARD_P(decl) (TREE_PUBLIC (decl) && (DECL_COMMON (decl) \
> > || DECL_ONE_ONLY (decl) \
> > || DECL_WEAK (decl) \
> > ||
> > (!TARGET_WEAK_NOT_IN_ARCHIVE_TOC \
> > || (! DECL_EXPLICIT_INSTANTIATION (decl) \
> > && ! DECL_TEMPLATE_SPECIALIZATION (decl)))))
> >
> > ?
>
> The latter.
Thanks. But this doesn't pass the test case on darwin. I'm not familiar
enough with the C++ FE to understand TARGET_WEAK_NOT_IN_ARCHIVE_TOC. Could you
double check the above. The "!" in front of DECL_EXPLICIT_INSTANTIATION looks
especially suspicious to me.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28017
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/28017] lack of guard variables for explicitly instantiated template static data
2006-06-13 19:13 [Bug c++/28017] New: " hhinnant at apple dot com
` (4 preceding siblings ...)
2006-06-13 21:24 ` hhinnant at apple dot com
@ 2006-06-13 21:41 ` pinskia at physics dot uc dot edu
2006-06-13 21:47 ` hhinnant at apple dot com
` (6 subsequent siblings)
12 siblings, 0 replies; 16+ messages in thread
From: pinskia at physics dot uc dot edu @ 2006-06-13 21:41 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from pinskia at physics dot uc dot edu 2006-06-13 21:24 -------
Subject: Re: lack of guard variables for explicitly instantiated template
static data
> #define NEEDS_GUARD_P(decl) (TREE_PUBLIC (decl) && (DECL_COMMON (decl) \
> || DECL_ONE_ONLY (decl) \
> || DECL_WEAK (decl) \
> ||
> (!TARGET_WEAK_NOT_IN_ARCHIVE_TOC \
> || (! DECL_EXPLICIT_INSTANTIATION (decl) \
> && ! DECL_TEMPLATE_SPECIALIZATION (decl)))))
>
> ?
The latter.
-- Pinski
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28017
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Bug c++/28017] lack of guard variables for explicitly instantiated template static data
2006-06-13 21:24 ` hhinnant at apple dot com
@ 2006-06-13 21:25 ` Andrew Pinski
0 siblings, 0 replies; 16+ messages in thread
From: Andrew Pinski @ 2006-06-13 21:25 UTC (permalink / raw)
To: gcc-bugzilla; +Cc: gcc-bugs
> #define NEEDS_GUARD_P(decl) (TREE_PUBLIC (decl) && (DECL_COMMON (decl) \
> || DECL_ONE_ONLY (decl) \
> || DECL_WEAK (decl) \
> ||
> (!TARGET_WEAK_NOT_IN_ARCHIVE_TOC \
> || (! DECL_EXPLICIT_INSTANTIATION (decl) \
> && ! DECL_TEMPLATE_SPECIALIZATION (decl)))))
>
> ?
The latter.
-- Pinski
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/28017] lack of guard variables for explicitly instantiated template static data
2006-06-13 19:13 [Bug c++/28017] New: " hhinnant at apple dot com
` (3 preceding siblings ...)
2006-06-13 19:39 ` pinskia at gcc dot gnu dot org
@ 2006-06-13 21:24 ` hhinnant at apple dot com
2006-06-13 21:25 ` Andrew Pinski
2006-06-13 21:41 ` pinskia at physics dot uc dot edu
` (7 subsequent siblings)
12 siblings, 1 reply; 16+ messages in thread
From: hhinnant at apple dot com @ 2006-06-13 21:24 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from hhinnant at apple dot com 2006-06-13 21:23 -------
(In reply to comment #4)
> For Darwin we do not want explicit instantiations to be
> linkonce. */
>
>
> This is why this testcase fails on darwin.
> We should instead of just adding DECL_EXPLICIT_INSTANTIATION, check
> TARGET_WEAK_NOT_IN_ARCHIVE_TOC.
>
> (!TARGET_WEAK_NOT_IN_ARCHIVE_TOC
> || (! DECL_EXPLICIT_INSTANTIATION (decl)
> && ! DECL_TEMPLATE_SPECIALIZATION (decl)))
>
> This is a darwin only issue.
I'm having trouble deciding exactly what you mean. Is this what you mean:
#define NEEDS_GUARD_P(decl) (!TARGET_WEAK_NOT_IN_ARCHIVE_TOC \
|| (! DECL_EXPLICIT_INSTANTIATION (decl) \
&& ! DECL_TEMPLATE_SPECIALIZATION (decl)))
Or do you mean:
#define NEEDS_GUARD_P(decl) (TREE_PUBLIC (decl) && (DECL_COMMON (decl) \
|| DECL_ONE_ONLY (decl) \
|| DECL_WEAK (decl) \
||
(!TARGET_WEAK_NOT_IN_ARCHIVE_TOC \
|| (! DECL_EXPLICIT_INSTANTIATION (decl) \
&& ! DECL_TEMPLATE_SPECIALIZATION (decl)))))
?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28017
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/28017] lack of guard variables for explicitly instantiated template static data
2006-06-13 19:13 [Bug c++/28017] New: " hhinnant at apple dot com
` (2 preceding siblings ...)
2006-06-13 19:19 ` pinskia at gcc dot gnu dot org
@ 2006-06-13 19:39 ` pinskia at gcc dot gnu dot org
2006-06-13 21:24 ` hhinnant at apple dot com
` (8 subsequent siblings)
12 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-06-13 19:39 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from pinskia at gcc dot gnu dot org 2006-06-13 19:37 -------
For Darwin we do not want explicit instantiations to be
linkonce. */
This is why this testcase fails on darwin.
We should instead of just adding DECL_EXPLICIT_INSTANTIATION, check
TARGET_WEAK_NOT_IN_ARCHIVE_TOC.
(!TARGET_WEAK_NOT_IN_ARCHIVE_TOC
|| (! DECL_EXPLICIT_INSTANTIATION (decl)
&& ! DECL_TEMPLATE_SPECIALIZATION (decl)))
This is a darwin only issue.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2006-06-13 19:37:25
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28017
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/28017] lack of guard variables for explicitly instantiated template static data
2006-06-13 19:13 [Bug c++/28017] New: " hhinnant at apple dot com
2006-06-13 19:15 ` [Bug c++/28017] " pinskia at gcc dot gnu dot org
2006-06-13 19:18 ` pinskia at gcc dot gnu dot org
@ 2006-06-13 19:19 ` pinskia at gcc dot gnu dot org
2006-06-13 19:39 ` pinskia at gcc dot gnu dot org
` (9 subsequent siblings)
12 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-06-13 19:19 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2006-06-13 19:18 -------
|| DECL_ONE_ONLY (decl) || DECL_WEAK (decl) \
Actually those looks should include what is defined for Darwin.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
GCC host triplet|darwin ppc |
GCC target triplet| |*-darwin
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28017
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/28017] lack of guard variables for explicitly instantiated template static data
2006-06-13 19:13 [Bug c++/28017] New: " hhinnant at apple dot com
2006-06-13 19:15 ` [Bug c++/28017] " pinskia at gcc dot gnu dot org
@ 2006-06-13 19:18 ` pinskia at gcc dot gnu dot org
2006-06-13 19:19 ` pinskia at gcc dot gnu dot org
` (10 subsequent siblings)
12 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-06-13 19:18 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2006-06-13 19:15 -------
(In reply to comment #1)
> This works on x86-linux-gnu on the mainline.
Oh and in 3.3.3.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28017
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug c++/28017] lack of guard variables for explicitly instantiated template static data
2006-06-13 19:13 [Bug c++/28017] New: " hhinnant at apple dot com
@ 2006-06-13 19:15 ` pinskia at gcc dot gnu dot org
2006-06-13 19:18 ` pinskia at gcc dot gnu dot org
` (11 subsequent siblings)
12 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-06-13 19:15 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2006-06-13 19:14 -------
This works on x86-linux-gnu on the mainline.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28017
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2024-04-03 23:13 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-28017-4@http.gcc.gnu.org/bugzilla/>
2024-04-03 23:13 ` [Bug c++/28017] lack of guard variables for explicitly instantiated template static data pinskia at gcc dot gnu.org
2006-06-13 19:13 [Bug c++/28017] New: " hhinnant at apple dot com
2006-06-13 19:15 ` [Bug c++/28017] " pinskia at gcc dot gnu dot org
2006-06-13 19:18 ` pinskia at gcc dot gnu dot org
2006-06-13 19:19 ` pinskia at gcc dot gnu dot org
2006-06-13 19:39 ` pinskia at gcc dot gnu dot org
2006-06-13 21:24 ` hhinnant at apple dot com
2006-06-13 21:25 ` Andrew Pinski
2006-06-13 21:41 ` pinskia at physics dot uc dot edu
2006-06-13 21:47 ` hhinnant at apple dot com
2006-06-13 21:47 ` Andrew Pinski
2006-06-13 22:02 ` pinskia at physics dot uc dot edu
2006-06-13 23:28 ` hhinnant at apple dot com
2006-06-19 18:22 ` hhinnant at apple dot com
2006-06-21 5:05 ` pinskia at gcc dot gnu dot org
2006-06-21 5:08 ` pinskia at gcc dot gnu dot org
2009-01-27 17:26 ` bkoz at gcc dot gnu dot 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).