public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "Georg dot Baum at post dot rwth-aachen dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/27557]  New: OpenMP threadprivate directive does not work with non-POD types
Date: Thu, 11 May 2006 14:45:00 -0000	[thread overview]
Message-ID: <bug-27557-12211@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2006-05-11 14:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-11 14:45 Georg dot Baum at post dot rwth-aachen dot de [this message]
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

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-27557-12211@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: link
Be 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).