public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/104329] New: [12 Regression] ICE in resolve_omp_atomic,  at fortran/openmp.cc:7827 (etc.)
@ 2022-02-01 17:38 gscfq@t-online.de
  2022-02-02  7:11 ` [Bug fortran/104329] " rguenth at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: gscfq@t-online.de @ 2022-02-01 17:38 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104329
           Summary: [12 Regression] ICE in resolve_omp_atomic, at
                    fortran/openmp.cc:7827 (etc.)
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gscfq@t-online.de
  Target Milestone: ---

This is marked as a regression because r5 has an ICE,
r6..r11 gives an error, and r12 gives an ICE again.
It started between 20211128 and 20211205 :


$ cat z1.f90
program p
   character(:), allocatable :: x(:)
   x = ['123']
   !$omp atomic update
   x = (x)
end


$ cat z2.f90
program p
   character(:), allocatable :: x(:)
   x = ['123']
   !$omp atomic update
   x = 'a' // x // 'e'
end


$ cat z3.f90
program p
   character(:), allocatable :: x(:)
   x = ['123']
   !$omp atomic capture
   x = 'a' // x // 'e'
   x = x
end


$ gfortran-12-20220130 -c z1.f90 -fopenmp
f951: internal compiler error: in resolve_omp_atomic, at fortran/openmp.cc:7827
0x7389bc resolve_omp_atomic
        ../../gcc/fortran/openmp.cc:7827
0x76790b gfc_resolve_code(gfc_code*, gfc_namespace*)
        ../../gcc/fortran/resolve.cc:12365
0x769407 resolve_codes
        ../../gcc/fortran/resolve.cc:17537
0x7694ce gfc_resolve(gfc_namespace*)
        ../../gcc/fortran/resolve.cc:17572
0x7517f4 resolve_all_program_units
        ../../gcc/fortran/parse.cc:6586
0x7517f4 gfc_parse_file()
        ../../gcc/fortran/parse.cc:6842
0x79eecf gfc_be_parse_file
        ../../gcc/fortran/f95-lang.cc:216

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

* [Bug fortran/104329] [12 Regression] ICE in resolve_omp_atomic, at fortran/openmp.cc:7827 (etc.)
  2022-02-01 17:38 [Bug fortran/104329] New: [12 Regression] ICE in resolve_omp_atomic, at fortran/openmp.cc:7827 (etc.) gscfq@t-online.de
@ 2022-02-02  7:11 ` rguenth at gcc dot gnu.org
  2022-02-02 10:11 ` [Bug fortran/104329] [12 Regression] ICE in resolve_omp_atomic, at fortran/openmp.cc:7827 (etc.) since r12-5793-g689407ef916503b2 marxin at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-02-02  7:11 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.0
           Priority|P3                          |P4

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

* [Bug fortran/104329] [12 Regression] ICE in resolve_omp_atomic, at fortran/openmp.cc:7827 (etc.) since r12-5793-g689407ef916503b2
  2022-02-01 17:38 [Bug fortran/104329] New: [12 Regression] ICE in resolve_omp_atomic, at fortran/openmp.cc:7827 (etc.) gscfq@t-online.de
  2022-02-02  7:11 ` [Bug fortran/104329] " rguenth at gcc dot gnu.org
@ 2022-02-02 10:11 ` marxin at gcc dot gnu.org
  2022-02-03 17:31 ` burnus at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-02-02 10:11 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org
     Ever confirmed|0                           |1
            Summary|[12 Regression] ICE in      |[12 Regression] ICE in
                   |resolve_omp_atomic, at      |resolve_omp_atomic, at
                   |fortran/openmp.cc:7827      |fortran/openmp.cc:7827
                   |(etc.)                      |(etc.) since
                   |                            |r12-5793-g689407ef916503b2
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-02-02

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r12-5793-g689407ef916503b2.

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

* [Bug fortran/104329] [12 Regression] ICE in resolve_omp_atomic, at fortran/openmp.cc:7827 (etc.) since r12-5793-g689407ef916503b2
  2022-02-01 17:38 [Bug fortran/104329] New: [12 Regression] ICE in resolve_omp_atomic, at fortran/openmp.cc:7827 (etc.) gscfq@t-online.de
  2022-02-02  7:11 ` [Bug fortran/104329] " rguenth at gcc dot gnu.org
  2022-02-02 10:11 ` [Bug fortran/104329] [12 Regression] ICE in resolve_omp_atomic, at fortran/openmp.cc:7827 (etc.) since r12-5793-g689407ef916503b2 marxin at gcc dot gnu.org
@ 2022-02-03 17:31 ` burnus at gcc dot gnu.org
  2022-02-10  8:31 ` cvs-commit at gcc dot gnu.org
  2022-02-10 10:49 ` burnus at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu.org @ 2022-02-03 17:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
The problem is related to
     x = ['123']
generates the AST
  ASSIGN z1:_F.DA0(FULL) (parens z1:x(FULL))
  ASSIGN z1:x(FULL) z1:_F.DA0(FULL)

The following should fix it - at least it fixes the three examples by erroring
out with:
  Error: !$OMP ATOMIC statement must set a scalar variable of intrinsic type at
(1)

--- a/gcc/fortran/openmp.cc
+++ b/gcc/fortran/openmp.cc
@@ -7690 +7690 @@ resolve_omp_atomic (gfc_code *code)
-  gfc_code *stmt = NULL, *capture_stmt = NULL;
+  gfc_code *stmt = NULL, *capture_stmt = NULL, *tailing_stmt = NULL;
@@ -7828 +7828,2 @@ resolve_omp_atomic (gfc_code *code)
-      gcc_assert (!code->next->next);
+      /* Shall be NULL but can happen for invalid code. */
+      tailing_stmt = code->next->next;
@@ -7836 +7837,2 @@ resolve_omp_atomic (gfc_code *code)
-      gcc_assert (!code->next);
+      /* Shall be NULL but can happen for invalid code. */
+      tailing_stmt = code->next;
@@ -7888,0 +7891,3 @@ resolve_omp_atomic (gfc_code *code)
+  /* Should be diagnosed above already. */
+  gcc_assert (tailing_stmt == NULL);
+

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

* [Bug fortran/104329] [12 Regression] ICE in resolve_omp_atomic, at fortran/openmp.cc:7827 (etc.) since r12-5793-g689407ef916503b2
  2022-02-01 17:38 [Bug fortran/104329] New: [12 Regression] ICE in resolve_omp_atomic, at fortran/openmp.cc:7827 (etc.) gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2022-02-03 17:31 ` burnus at gcc dot gnu.org
@ 2022-02-10  8:31 ` cvs-commit at gcc dot gnu.org
  2022-02-10 10:49 ` burnus at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-02-10  8:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tobias Burnus <burnus@gcc.gnu.org>:

https://gcc.gnu.org/g:9694f6121982668285a21020b55b44c3099f7042

commit r12-7169-g9694f6121982668285a21020b55b44c3099f7042
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Thu Feb 10 09:30:19 2022 +0100

    Fortran/OpenMP: Avoid ICE for invalid char array in omp atomic [PR104329]

            PR fortran/104329
    gcc/fortran/ChangeLog:

            * openmp.cc (resolve_omp_atomic): Defer extra-code assert after
            other diagnostics.

    gcc/testsuite/ChangeLog:

            * gfortran.dg/gomp/atomic-28.f90: New test.

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

* [Bug fortran/104329] [12 Regression] ICE in resolve_omp_atomic, at fortran/openmp.cc:7827 (etc.) since r12-5793-g689407ef916503b2
  2022-02-01 17:38 [Bug fortran/104329] New: [12 Regression] ICE in resolve_omp_atomic, at fortran/openmp.cc:7827 (etc.) gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2022-02-10  8:31 ` cvs-commit at gcc dot gnu.org
@ 2022-02-10 10:49 ` burnus at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu.org @ 2022-02-10 10:49 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

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

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> ---
FIXED.

Thanks for the report :-)

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

end of thread, other threads:[~2022-02-10 10:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-01 17:38 [Bug fortran/104329] New: [12 Regression] ICE in resolve_omp_atomic, at fortran/openmp.cc:7827 (etc.) gscfq@t-online.de
2022-02-02  7:11 ` [Bug fortran/104329] " rguenth at gcc dot gnu.org
2022-02-02 10:11 ` [Bug fortran/104329] [12 Regression] ICE in resolve_omp_atomic, at fortran/openmp.cc:7827 (etc.) since r12-5793-g689407ef916503b2 marxin at gcc dot gnu.org
2022-02-03 17:31 ` burnus at gcc dot gnu.org
2022-02-10  8:31 ` cvs-commit at gcc dot gnu.org
2022-02-10 10:49 ` burnus 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).