public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgomp/108286] New: [GCC 12/13] OpenMP Target directive causes internal compiler error
@ 2023-01-04 17:11 j.reuter@fz-juelich.de
  2023-01-04 18:06 ` [Bug c++/108286] " jakub at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: j.reuter@fz-juelich.de @ 2023-01-04 17:11 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108286
           Summary: [GCC 12/13] OpenMP Target directive causes internal
                    compiler error
           Product: gcc
           Version: 12.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgomp
          Assignee: unassigned at gcc dot gnu.org
          Reporter: j.reuter@fz-juelich.de
                CC: jakub at gcc dot gnu.org
  Target Milestone: ---

Created attachment 54189
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54189&action=edit
Source Code, .ii and .s file of GCC 12, .out file of GCC 13 (experimental)

I've been tinkering around with OpenMP Target in the last few weeks. I ran into
issues with other compilers while testing omp target enter and exit data. While
trying GCC, I ran into a Segmentation Fault during the compilation. I could
reduce the source code to the code shown below. 

Tested system:
- Fedora Linux 37
- GCC 12.2.1

I was able to reproduce the same error with GodBolt using both x86-64 gcc 12.2
and x86-64 gcc 12.1 and the GCC 12.2 Docker container. Previous versions (11.x
and lower) throw error messages during compilation instead and do not crash. 
Link: https://godbolt.org/z/E5f6G7dP9

GCC 13.0 (2023-01-01) also results in internal compiler errors with the error
message (Preprocessed source of that version attached as well):
internal compiler error: tree check: expected private or shared or firstprivate
or lastprivate or reduction or task_reduction or in_reduction or copyin or
copyprivate or linear or affinity or aligned or allocate or depend or
nontemporal or uniform or enter or link or detach or use_device_ptr or
use_device_addr or is_device_ptr or inclusive or exclusive or from or to or map
or has_device_addr or doacross or _cache_ or gang or async or wait or auto or
seq or _looptemp_ or _reductemp_ or _condtemp_ or _scantemp_, have abs_expr in
finish_omp_target_clauses, at cp/semantics.cc:9830

How to reproduce:
--> error.cpp

class ErrorClass {
    void causeError() {
#pragma omp target map(size, ptr[:size]) nowait
#pragma omp teams
    float error = ptr[0];
}

unsigned size = 5;
float* ptr = new float[size];
};


bash> g++ -fopenmp error.cpp
error.cpp: In member function 'void ErrorClass::causeError()':
error.cpp:5:25: internal compiler error: Segmentation fault
    5 |     float error = ptr[0];
      |                         ^
0x1bb069e internal_error(char const*, ...)
        ???:0
0x8b4857 finish_omp_target_clauses(unsigned int, tree_node*, tree_node**)
        ???:0
0x8b6824 finish_omp_target(unsigned int, tree_node*, tree_node*, bool)
        ???:0
0x861eaa c_parse_file()
        ???:0
0x93e4e5 c_common_parse_file()
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1

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

* [Bug c++/108286] [GCC 12/13] OpenMP Target directive causes internal compiler error
  2023-01-04 17:11 [Bug libgomp/108286] New: [GCC 12/13] OpenMP Target directive causes internal compiler error j.reuter@fz-juelich.de
@ 2023-01-04 18:06 ` jakub at gcc dot gnu.org
  2023-01-04 18:25 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-01-04 18:06 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.3
                 CC|                            |burnus at gcc dot gnu.org,
                   |                            |cltang at gcc dot gnu.org
           Priority|P3                          |P2

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r12-5835-g0ab29cf0bb68960c1f87405f14b4fb2109254e2f , before that
commit it has been rejected.  Only OpenMP 5.0 clarified what means mapping of
non-static data members in methods, so I think the rejection was fine before
that.

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

* [Bug c++/108286] [GCC 12/13] OpenMP Target directive causes internal compiler error
  2023-01-04 17:11 [Bug libgomp/108286] New: [GCC 12/13] OpenMP Target directive causes internal compiler error j.reuter@fz-juelich.de
  2023-01-04 18:06 ` [Bug c++/108286] " jakub at gcc dot gnu.org
@ 2023-01-04 18:25 ` jakub at gcc dot gnu.org
  2023-01-05 11:01 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-01-04 18:25 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-01-04
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org
             Status|UNCONFIRMED                 |ASSIGNED

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 54190
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54190&action=edit
gcc13-pr108286.patch

Untested fix.

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

* [Bug c++/108286] [GCC 12/13] OpenMP Target directive causes internal compiler error
  2023-01-04 17:11 [Bug libgomp/108286] New: [GCC 12/13] OpenMP Target directive causes internal compiler error j.reuter@fz-juelich.de
  2023-01-04 18:06 ` [Bug c++/108286] " jakub at gcc dot gnu.org
  2023-01-04 18:25 ` jakub at gcc dot gnu.org
@ 2023-01-05 11:01 ` cvs-commit at gcc dot gnu.org
  2023-01-05 11:04 ` [Bug c++/108286] [12 Regression] " jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-01-05 11:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS 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:29c3218618ef6177dc33871b26c8fbd9b21eabe1

commit r13-5006-g29c3218618ef6177dc33871b26c8fbd9b21eabe1
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Jan 5 11:57:30 2023 +0100

    openmp: Fix up finish_omp_target_clauses [PR108286]

    The comment in the loop says that we shouldn't add a map clause if such
    a clause exists already, but the loop was actually using OMP_CLAUSE_DECL
    on any clause.  Target construct can have various clauses which don't
    have OMP_CLAUSE_DECL at all (e.g. nowait, device or if) or clause
    where it means something different (e.g. privatization clauses, allocate,
    depend).

    So, only check OMP_CLAUSE_DECL on OMP_CLAUSE_MAP clauses.

    2023-01-05  Jakub Jelinek  <jakub@redhat.com>

            PR c++/108286
            * semantics.cc (finish_omp_target_clauses): Ignore clauses other
than
            OMP_CLAUSE_MAP.

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

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

* [Bug c++/108286] [12 Regression] OpenMP Target directive causes internal compiler error
  2023-01-04 17:11 [Bug libgomp/108286] New: [GCC 12/13] OpenMP Target directive causes internal compiler error j.reuter@fz-juelich.de
                   ` (2 preceding siblings ...)
  2023-01-05 11:01 ` cvs-commit at gcc dot gnu.org
@ 2023-01-05 11:04 ` jakub at gcc dot gnu.org
  2023-01-06 10:37 ` j.reuter@fz-juelich.de
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-01-05 11:04 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[GCC 12/13] OpenMP Target   |[12 Regression] OpenMP
                   |directive causes internal   |Target directive causes
                   |compiler error              |internal compiler error

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed on the trunk so far.

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

* [Bug c++/108286] [12 Regression] OpenMP Target directive causes internal compiler error
  2023-01-04 17:11 [Bug libgomp/108286] New: [GCC 12/13] OpenMP Target directive causes internal compiler error j.reuter@fz-juelich.de
                   ` (3 preceding siblings ...)
  2023-01-05 11:04 ` [Bug c++/108286] [12 Regression] " jakub at gcc dot gnu.org
@ 2023-01-06 10:37 ` j.reuter@fz-juelich.de
  2023-02-10 17:45 ` cvs-commit at gcc dot gnu.org
  2023-02-10 17:59 ` jakub at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: j.reuter@fz-juelich.de @ 2023-01-06 10:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jan André Reuter <j.reuter@fz-juelich.de> ---
I tried to compile and run the source code I uploaded when creating the ticket.
I used the latest daily bump:
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=53ef7c1d9a44a2c681d4b3433a853cd4461be8c5

The program compiles without issues now and runs correctly when adding a main
function.

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

* [Bug c++/108286] [12 Regression] OpenMP Target directive causes internal compiler error
  2023-01-04 17:11 [Bug libgomp/108286] New: [GCC 12/13] OpenMP Target directive causes internal compiler error j.reuter@fz-juelich.de
                   ` (4 preceding siblings ...)
  2023-01-06 10:37 ` j.reuter@fz-juelich.de
@ 2023-02-10 17:45 ` cvs-commit at gcc dot gnu.org
  2023-02-10 17:59 ` jakub at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-02-10 17:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:5de999df9fa0134a1621b552eb2abd65a6384ffd

commit r12-9138-g5de999df9fa0134a1621b552eb2abd65a6384ffd
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Jan 5 11:57:30 2023 +0100

    openmp: Fix up finish_omp_target_clauses [PR108286]

    The comment in the loop says that we shouldn't add a map clause if such
    a clause exists already, but the loop was actually using OMP_CLAUSE_DECL
    on any clause.  Target construct can have various clauses which don't
    have OMP_CLAUSE_DECL at all (e.g. nowait, device or if) or clause
    where it means something different (e.g. privatization clauses, allocate,
    depend).

    So, only check OMP_CLAUSE_DECL on OMP_CLAUSE_MAP clauses.

    2023-01-05  Jakub Jelinek  <jakub@redhat.com>

            PR c++/108286
            * semantics.cc (finish_omp_target_clauses): Ignore clauses other
than
            OMP_CLAUSE_MAP.

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

    (cherry picked from commit 29c3218618ef6177dc33871b26c8fbd9b21eabe1)

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

* [Bug c++/108286] [12 Regression] OpenMP Target directive causes internal compiler error
  2023-01-04 17:11 [Bug libgomp/108286] New: [GCC 12/13] OpenMP Target directive causes internal compiler error j.reuter@fz-juelich.de
                   ` (5 preceding siblings ...)
  2023-02-10 17:45 ` cvs-commit at gcc dot gnu.org
@ 2023-02-10 17:59 ` jakub at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-02-10 17:59 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

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

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

end of thread, other threads:[~2023-02-10 17:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-04 17:11 [Bug libgomp/108286] New: [GCC 12/13] OpenMP Target directive causes internal compiler error j.reuter@fz-juelich.de
2023-01-04 18:06 ` [Bug c++/108286] " jakub at gcc dot gnu.org
2023-01-04 18:25 ` jakub at gcc dot gnu.org
2023-01-05 11:01 ` cvs-commit at gcc dot gnu.org
2023-01-05 11:04 ` [Bug c++/108286] [12 Regression] " jakub at gcc dot gnu.org
2023-01-06 10:37 ` j.reuter@fz-juelich.de
2023-02-10 17:45 ` cvs-commit at gcc dot gnu.org
2023-02-10 17:59 ` 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).