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

            Bug ID: 114572
           Summary: [OpenMP] "internal compiler error: in assign_temp"
                    with assignment operator and lastprivate clause
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: j.reu...@fz-juelich.de
  Target Milestone: ---

Created attachment 57859
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57859&action=edit
Preprocessed output GCC 13 (Fedora)

Using the following source code, GCC 11 and 12 on Ubuntu 22.04 and 13 on Fedora
39 abort with an internal compiler error. I was also able to reproduce the
issue on Godbolt with GCC trunk:


struct c1
{
    ~c1(){}
    c1 operator=(const c1& other)
    {
        return *this;
    }
};

int main( void )
{
    c1 c;
    #pragma omp parallel for lastprivate(c)
    for(int i = 0; i < 10; ++i){}
}


Compiling the code with:
g++ -fopenmp gcc-error.cpp


fails with:
during RTL pass: expand
gcc-error.cpp: In function ‘main._omp_fn.0’:
gcc-error.cpp:16:5: internal compiler error: in assign_temp, at function.cc:988
   16 |     for(int i = 0; i < 10; ++i){}
      |     ^~~
Please submit a full bug report, with preprocessed source.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
Preprocessed source stored into /tmp/cck1AuEN.out file, please attach this to
your bugreport.


Removing both the copy constructor and destructor fixes the issue. Adding
either of them independently causes the error to appear. The log file is
attached.

Godbolt: https://godbolt.org/z/nMve88eEo

Reply via email to