public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/108180] New: [OpenMP] Passing a class member variable to firstprivate() erroneously calls its dtor
@ 2022-12-19 17:41 info@ebner-markus.de
  2022-12-20 11:56 ` [Bug c++/108180] " jakub at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: info@ebner-markus.de @ 2022-12-19 17:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108180

            Bug ID: 108180
           Summary: [OpenMP] Passing a class member variable to
                    firstprivate() erroneously calls its dtor
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: info@ebner-markus.de
  Target Milestone: ---

Created attachment 54128
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54128&action=edit
Minimal example cpp

Following situation:
I have a class. This class has a member variable (itself of a complex type).
The class also has a member function in which an OpenMP loop (#pragma omp
parallel for) is used. This loop accesses the mentioned class member variable
through the firstprivate() flag.
As far as I understood, this should copy the variable into every worker thread
by calling the copy constructor.
However, now upon leaving the class's member function, the dtor of the class
member variable is called.

Here is a code example: https://godbolt.org/z/oxb3Pq9he
The log shows, that the dtor of the mentioned class member variable is
erroneously called twice.

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

end of thread, other threads:[~2023-05-04  7:22 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-19 17:41 [Bug c++/108180] New: [OpenMP] Passing a class member variable to firstprivate() erroneously calls its dtor info@ebner-markus.de
2022-12-20 11:56 ` [Bug c++/108180] " jakub at gcc dot gnu.org
2022-12-21  8:10 ` cvs-commit at gcc dot gnu.org
2022-12-21  8:27 ` jakub at gcc dot gnu.org
2023-02-10 17:44 ` cvs-commit at gcc dot gnu.org
2023-05-02 20:13 ` cvs-commit at gcc dot gnu.org
2023-05-03  9:34 ` jakub at gcc dot gnu.org
2023-05-03 15:20 ` cvs-commit at gcc dot gnu.org
2023-05-04  7:22 ` 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).