public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114572] New: [OpenMP] "internal compiler error: in assign_temp" with assignment operator and lastprivate clause
@ 2024-04-03  9:41 j.reuter@fz-juelich.de
  2024-04-03 11:28 ` [Bug c++/114572] " jakub at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: j.reuter@fz-juelich.de @ 2024-04-03  9:41 UTC (permalink / raw)
  To: gcc-bugs

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.reuter@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

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

* [Bug c++/114572] [OpenMP] "internal compiler error: in assign_temp" with assignment operator and lastprivate clause
  2024-04-03  9:41 [Bug c++/114572] New: [OpenMP] "internal compiler error: in assign_temp" with assignment operator and lastprivate clause j.reuter@fz-juelich.de
@ 2024-04-03 11:28 ` jakub at gcc dot gnu.org
  2024-04-03 17:17 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-04-03 11:28 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Guess nobody expected copy assignment operator to return something that would
need to be destructed in the lastprivate clause handling.
Normally copy assignment operators return reference, not the object being
modified by value.

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

* [Bug c++/114572] [OpenMP] "internal compiler error: in assign_temp" with assignment operator and lastprivate clause
  2024-04-03  9:41 [Bug c++/114572] New: [OpenMP] "internal compiler error: in assign_temp" with assignment operator and lastprivate clause j.reuter@fz-juelich.de
  2024-04-03 11:28 ` [Bug c++/114572] " jakub at gcc dot gnu.org
@ 2024-04-03 17:17 ` pinskia at gcc dot gnu.org
  2024-04-04 14:49 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-03 17:17 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-04-03
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

Hmm,
  this seems to have worked in GCC 5 and before but I don't know if that was
due to not having checking here or not.

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

* [Bug c++/114572] [OpenMP] "internal compiler error: in assign_temp" with assignment operator and lastprivate clause
  2024-04-03  9:41 [Bug c++/114572] New: [OpenMP] "internal compiler error: in assign_temp" with assignment operator and lastprivate clause j.reuter@fz-juelich.de
  2024-04-03 11:28 ` [Bug c++/114572] " jakub at gcc dot gnu.org
  2024-04-03 17:17 ` pinskia at gcc dot gnu.org
@ 2024-04-04 14:49 ` jakub at gcc dot gnu.org
  2024-04-05  7:34 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-04-04 14:49 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 57878
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57878&action=edit
gcc14-pr114572.patch

It never worked, we just didn't have that checking.  But, e.g. we would never
destruct the (unused) returned temporary, even if it had a non-trivial
destructor.

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

* [Bug c++/114572] [OpenMP] "internal compiler error: in assign_temp" with assignment operator and lastprivate clause
  2024-04-03  9:41 [Bug c++/114572] New: [OpenMP] "internal compiler error: in assign_temp" with assignment operator and lastprivate clause j.reuter@fz-juelich.de
                   ` (2 preceding siblings ...)
  2024-04-04 14:49 ` jakub at gcc dot gnu.org
@ 2024-04-05  7:34 ` cvs-commit at gcc dot gnu.org
  2024-04-21  4:08 ` cvs-commit at gcc dot gnu.org
  2024-04-23  6:45 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-04-05  7:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:592536eb3c0a97a55b1019ff0216ef77e6ca847e

commit r14-9801-g592536eb3c0a97a55b1019ff0216ef77e6ca847e
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Apr 5 09:31:28 2024 +0200

    c++: Fix ICE with weird copy assignment operator [PR114572]

    While ctors/dtors don't return anything (undeclared void or this pointer
    on arm) and copy assignment operators normally return a reference to *this,
    it isn't invalid to return uselessly some class object which might need
    destructing, but the OpenMP clause handling code wasn't expecting that.

    The following patch fixes that.

    2024-04-05  Jakub Jelinek  <jakub@redhat.com>

            PR c++/114572
            * cp-gimplify.cc (cxx_omp_clause_apply_fn): Call build_cplus_new
            on build_call_a result if it has class type.

            * testsuite/libgomp.c++/pr114572.C: New test.

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

* [Bug c++/114572] [OpenMP] "internal compiler error: in assign_temp" with assignment operator and lastprivate clause
  2024-04-03  9:41 [Bug c++/114572] New: [OpenMP] "internal compiler error: in assign_temp" with assignment operator and lastprivate clause j.reuter@fz-juelich.de
                   ` (3 preceding siblings ...)
  2024-04-05  7:34 ` cvs-commit at gcc dot gnu.org
@ 2024-04-21  4:08 ` cvs-commit at gcc dot gnu.org
  2024-04-23  6:45 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-04-21  4:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:910fa4d9df8f72d16279324cca2bf1f2649aa68b

commit r13-8627-g910fa4d9df8f72d16279324cca2bf1f2649aa68b
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Apr 5 09:31:28 2024 +0200

    c++: Fix ICE with weird copy assignment operator [PR114572]

    While ctors/dtors don't return anything (undeclared void or this pointer
    on arm) and copy assignment operators normally return a reference to *this,
    it isn't invalid to return uselessly some class object which might need
    destructing, but the OpenMP clause handling code wasn't expecting that.

    The following patch fixes that.

    2024-04-05  Jakub Jelinek  <jakub@redhat.com>

            PR c++/114572
            * cp-gimplify.cc (cxx_omp_clause_apply_fn): Call build_cplus_new
            on build_call_a result if it has class type.

            * testsuite/libgomp.c++/pr114572.C: New test.

    (cherry picked from commit 592536eb3c0a97a55b1019ff0216ef77e6ca847e)

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

* [Bug c++/114572] [OpenMP] "internal compiler error: in assign_temp" with assignment operator and lastprivate clause
  2024-04-03  9:41 [Bug c++/114572] New: [OpenMP] "internal compiler error: in assign_temp" with assignment operator and lastprivate clause j.reuter@fz-juelich.de
                   ` (4 preceding siblings ...)
  2024-04-21  4:08 ` cvs-commit at gcc dot gnu.org
@ 2024-04-23  6:45 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-04-23  6:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed for 13.3 too.

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

end of thread, other threads:[~2024-04-23  6:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-03  9:41 [Bug c++/114572] New: [OpenMP] "internal compiler error: in assign_temp" with assignment operator and lastprivate clause j.reuter@fz-juelich.de
2024-04-03 11:28 ` [Bug c++/114572] " jakub at gcc dot gnu.org
2024-04-03 17:17 ` pinskia at gcc dot gnu.org
2024-04-04 14:49 ` jakub at gcc dot gnu.org
2024-04-05  7:34 ` cvs-commit at gcc dot gnu.org
2024-04-21  4:08 ` cvs-commit at gcc dot gnu.org
2024-04-23  6:45 ` 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).