public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/27557]  New: OpenMP threadprivate directive does not work with non-POD types
@ 2006-05-11 14:45 Georg dot Baum at post dot rwth-aachen dot de
  2006-05-16 10:20 ` [Bug c++/27557] " jakub at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 20+ messages in thread
From: Georg dot Baum at post dot rwth-aachen dot de @ 2006-05-11 14:45 UTC (permalink / raw)
  To: gcc-bugs

Compiling the fragment

struct A {
        A() {}
};
extern A a;
#pragma omp threadprivate(a)
A a;

with svn from yesterday yields
LANG=C g++-4.2 -fopenmp -c x.cpp -o x.o
x.cpp:6: error: 'a' cannot be thread-local because it has non-POD type 'A'
x.cpp:6: error: 'a' is thread-local and so cannot be dynamically initialized

It works if I remove the definition of a (last line).
I could not find anything in the OpenMP spec (version 2.5) stating that non-POD
threadprivate variables are not allowed. If I change the above to

struct A {
        A() {}
};
A a;
#pragma omp threadprivate(a)

I get

LANG=C g++-4.2 -fopenmp -c x.cpp -o x.o
x.cpp:5: error: 'a' declared 'threadprivate' after first use

I believe that both variants are allowed by the OpenMP spec (version 2.5) and
they compile fine with icc 8.1. The spec says something about non-POD
variaables with explicit initializers in section 2.8.2 on page 69, but that
does not apply here. Please correct me if I am wrong.


-- 
           Summary: OpenMP threadprivate directive does not work with non-
                    POD types
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: Georg dot Baum at post dot rwth-aachen dot de


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27557


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2021-04-16 11:52 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-27557-4@http.gcc.gnu.org/bugzilla/>
2011-04-06 19:54 ` [Bug c++/27557] OpenMP threadprivate directive does not work with non-POD types brooks at gcc dot gnu.org
2012-10-15 20:36 ` jason at gcc dot gnu.org
2012-11-12 18:29 ` carlos at systemhalted dot org
2013-03-22 14:43 ` jakub at gcc dot gnu.org
2013-05-31 10:57 ` jakub at gcc dot gnu.org
2013-06-13  9:35 ` siddhesh at redhat dot com
2013-10-16  9:50 ` jakub at gcc dot gnu.org
2014-01-24 16:57 ` krafczyk.matthew at gmail dot com
2014-02-06  9:03 ` siddhesh at redhat dot com
2014-02-17  0:21 ` krafczyk.matthew at gmail dot com
2015-03-22  8:49 ` krafczyk.matthew at gmail dot com
2015-06-22 14:25 ` rguenth at gcc dot gnu.org
2021-04-16  8:36 ` jcownie at gmail dot com
2021-04-16 10:42 ` jakub at gcc dot gnu.org
2021-04-16 11:52 ` jcownie at gmail dot com
2006-05-11 14:45 [Bug c++/27557] New: " Georg dot Baum at post dot rwth-aachen dot de
2006-05-16 10:20 ` [Bug c++/27557] " jakub at gcc dot gnu dot org
2006-05-16 15:04 ` Georg dot Baum at post dot rwth-aachen dot de
2006-05-18 16:51 ` pinskia at gcc dot gnu dot org
2007-11-30 21:56 ` pinskia at gcc dot gnu dot org
2008-02-18  5:09 ` pinskia 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).