public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/60702] New: thread_local initialization @ 2014-03-28 22:47 dv.main at gmail dot com 2014-03-28 22:48 ` [Bug c++/60702] " dv.main at gmail dot com ` (5 more replies) 0 siblings, 6 replies; 7+ messages in thread From: dv.main at gmail dot com @ 2014-03-28 22:47 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60702 Bug ID: 60702 Summary: thread_local initialization Product: gcc Version: 4.8.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: dv.main at gmail dot com Created attachment 32480 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32480&action=edit Gcc verbose output Invalid thread local object initialization. Snippet: #include <iostream> using namespace std; struct far { struct boo { boo () { cerr << "bar::boo" << endl; } int i = 42; }; static void baz() { cerr << far::FOO.i << endl; } static thread_local boo FOO; }; thread_local typename far::boo far::FOO; int main() { far f; cerr << f.FOO.i << endl; cerr << far::FOO.i << endl; return 0; } Output: 0 bar::boo 42 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/60702] thread_local initialization 2014-03-28 22:47 [Bug c++/60702] New: thread_local initialization dv.main at gmail dot com @ 2014-03-28 22:48 ` dv.main at gmail dot com 2014-03-28 22:49 ` dv.main at gmail dot com ` (4 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: dv.main at gmail dot com @ 2014-03-28 22:48 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60702 --- Comment #1 from Stan Pavlovski <dv.main at gmail dot com> --- Created attachment 32481 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32481&action=edit Gcc temp output ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/60702] thread_local initialization 2014-03-28 22:47 [Bug c++/60702] New: thread_local initialization dv.main at gmail dot com 2014-03-28 22:48 ` [Bug c++/60702] " dv.main at gmail dot com @ 2014-03-28 22:49 ` dv.main at gmail dot com 2014-03-28 22:52 ` dv.main at gmail dot com ` (3 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: dv.main at gmail dot com @ 2014-03-28 22:49 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60702 --- Comment #2 from Stan Pavlovski <dv.main at gmail dot com> --- Created attachment 32482 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32482&action=edit Source file ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/60702] thread_local initialization 2014-03-28 22:47 [Bug c++/60702] New: thread_local initialization dv.main at gmail dot com 2014-03-28 22:48 ` [Bug c++/60702] " dv.main at gmail dot com 2014-03-28 22:49 ` dv.main at gmail dot com @ 2014-03-28 22:52 ` dv.main at gmail dot com 2014-04-02 22:44 ` arturomdn at gmail dot com ` (2 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: dv.main at gmail dot com @ 2014-03-28 22:52 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60702 --- Comment #3 from Stan Pavlovski <dv.main at gmail dot com> --- Template class' thread_local member is not initialized unless other non-template class' thread_local member is initialized first: #include <iostream> using namespace std; struct far { struct boo { boo () { cerr << "far::boo" << endl; } int i = 42; }; static void baz() { cerr << far::FOO.i << endl; } static thread_local boo FOO; }; template<class T> struct bar { struct foo { foo () { cerr << "bar::foo" << endl; } int i = 42; }; void baz() { cerr << bar::FOO.i << endl; } static thread_local foo FOO; }; template<class T> thread_local typename bar<T>::foo bar<T>::FOO; thread_local typename far::boo far::FOO; int main() { bar<int> b; b.baz(); far f; f.baz(); return 0; } Output: 0 far::boo bar::foo 42 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/60702] thread_local initialization 2014-03-28 22:47 [Bug c++/60702] New: thread_local initialization dv.main at gmail dot com ` (2 preceding siblings ...) 2014-03-28 22:52 ` dv.main at gmail dot com @ 2014-04-02 22:44 ` arturomdn at gmail dot com 2020-11-04 15:21 ` redi at gcc dot gnu.org 2021-08-22 22:48 ` pinskia at gcc dot gnu.org 5 siblings, 0 replies; 7+ messages in thread From: arturomdn at gmail dot com @ 2014-04-02 22:44 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60702 arturomdn at gmail dot com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |arturomdn at gmail dot com --- Comment #4 from arturomdn at gmail dot com --- Created attachment 32528 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32528&action=edit Smaller testcase that reproduces the problem clang had the same problem, this smaller test was submitted to the clang team and they identified it as a duplicate of a recently fixed bug: http://llvm.org/bugs/show_bug.cgi?id=19254 Which was fixed as follows http://llvm.org/viewvc/llvm-project?view=revision&revision=204869 With the following comment: PR19254: If a thread_local data member of a class is accessed via member access syntax, don't forget to run its initializer. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/60702] thread_local initialization 2014-03-28 22:47 [Bug c++/60702] New: thread_local initialization dv.main at gmail dot com ` (3 preceding siblings ...) 2014-04-02 22:44 ` arturomdn at gmail dot com @ 2020-11-04 15:21 ` redi at gcc dot gnu.org 2021-08-22 22:48 ` pinskia at gcc dot gnu.org 5 siblings, 0 replies; 7+ messages in thread From: redi at gcc dot gnu.org @ 2020-11-04 15:21 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60702 Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tobias.bruell at gmail dot com --- Comment #25 from Jonathan Wakely <redi at gcc dot gnu.org> --- *** Bug 88292 has been marked as a duplicate of this bug. *** ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/60702] thread_local initialization 2014-03-28 22:47 [Bug c++/60702] New: thread_local initialization dv.main at gmail dot com ` (4 preceding siblings ...) 2020-11-04 15:21 ` redi at gcc dot gnu.org @ 2021-08-22 22:48 ` pinskia at gcc dot gnu.org 5 siblings, 0 replies; 7+ messages in thread From: pinskia at gcc dot gnu.org @ 2021-08-22 22:48 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60702 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |michael at ensslin dot cc --- Comment #26 from Andrew Pinski <pinskia at gcc dot gnu.org> --- *** Bug 60673 has been marked as a duplicate of this bug. *** ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-08-22 22:48 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2014-03-28 22:47 [Bug c++/60702] New: thread_local initialization dv.main at gmail dot com 2014-03-28 22:48 ` [Bug c++/60702] " dv.main at gmail dot com 2014-03-28 22:49 ` dv.main at gmail dot com 2014-03-28 22:52 ` dv.main at gmail dot com 2014-04-02 22:44 ` arturomdn at gmail dot com 2020-11-04 15:21 ` redi at gcc dot gnu.org 2021-08-22 22:48 ` pinskia 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).