public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/103776] New: ICE in gfc_compare_string, at fortran/arith.c:1118
@ 2021-12-20 17:51 gscfq@t-online.de
  2021-12-20 20:03 ` [Bug fortran/103776] " anlauf at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: gscfq@t-online.de @ 2021-12-20 17:51 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103776
           Summary: ICE in gfc_compare_string, at fortran/arith.c:1118
           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: ---

Follow-up of pr103591, affects versions down to at least r5 :


$ cat z1.f90
program p
   integer :: n
   select case (n)
   case (['1']:2)
   end select
end


$ cat z3.f90
program p
   integer :: n
   select case (n)
   case(['1']:['2'])
   end select
end


$ gfortran-12-20211219 -c z1.f90
f951: internal compiler error: Segmentation fault
0xd6d1ff crash_signal
        ../../gcc/toplev.c:322
0x7663ba gfc_compare_string(gfc_expr*, gfc_expr*)
        ../../gcc/fortran/arith.c:1118
0x80c2b6 resolve_select
        ../../gcc/fortran/resolve.c:8784
0x815c67 gfc_resolve_code(gfc_code*, gfc_namespace*)
        ../../gcc/fortran/resolve.c:12165
0x817b27 resolve_codes
        ../../gcc/fortran/resolve.c:17532
0x817bee gfc_resolve(gfc_namespace*)
        ../../gcc/fortran/resolve.c:17567
0x7fff14 resolve_all_program_units
        ../../gcc/fortran/parse.c:6586
0x7fff14 gfc_parse_file()
        ../../gcc/fortran/parse.c:6842
0x84d53f gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:216

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

* [Bug fortran/103776] ICE in gfc_compare_string, at fortran/arith.c:1118
  2021-12-20 17:51 [Bug fortran/103776] New: ICE in gfc_compare_string, at fortran/arith.c:1118 gscfq@t-online.de
@ 2021-12-20 20:03 ` anlauf at gcc dot gnu.org
  2021-12-20 21:08 ` anlauf at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-12-20 20:03 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
                 CC|                            |anlauf at gcc dot gnu.org
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-12-20

--- Comment #1 from anlauf at gcc dot gnu.org ---
Testing the following obvious patch:

diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index 52bc5af7542..49a9e933ea3 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -6088,6 +6088,19 @@ match_case_selector (gfc_case **cp)
        }
     }

+  if (c->low && c->low->rank != 0)
+    {
+      gfc_error ("Expression in CASE statement at %L must be scalar",
+                &c->low->where);
+      goto cleanup;
+    }
+  if (c->high && c->high->rank != 0)
+    {
+      gfc_error ("Expression in CASE statement at %L must be scalar",
+                &c->high->where);
+      goto cleanup;
+    }
+
   *cp = c;
   return MATCH_YES;

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

* [Bug fortran/103776] ICE in gfc_compare_string, at fortran/arith.c:1118
  2021-12-20 17:51 [Bug fortran/103776] New: ICE in gfc_compare_string, at fortran/arith.c:1118 gscfq@t-online.de
  2021-12-20 20:03 ` [Bug fortran/103776] " anlauf at gcc dot gnu.org
@ 2021-12-20 21:08 ` anlauf at gcc dot gnu.org
  2021-12-22 19:09 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-12-20 21:08 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

--- Comment #2 from anlauf at gcc dot gnu.org ---
Submitted: https://gcc.gnu.org/pipermail/fortran/2021-December/057213.html

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

* [Bug fortran/103776] ICE in gfc_compare_string, at fortran/arith.c:1118
  2021-12-20 17:51 [Bug fortran/103776] New: ICE in gfc_compare_string, at fortran/arith.c:1118 gscfq@t-online.de
  2021-12-20 20:03 ` [Bug fortran/103776] " anlauf at gcc dot gnu.org
  2021-12-20 21:08 ` anlauf at gcc dot gnu.org
@ 2021-12-22 19:09 ` cvs-commit at gcc dot gnu.org
  2021-12-22 19:11 ` anlauf at gcc dot gnu.org
  2021-12-27 20:17 ` cvs-commit at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-12-22 19:09 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:5474092c9afbd76cbd457facce3757d8d2fad07b

commit r12-6100-g5474092c9afbd76cbd457facce3757d8d2fad07b
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Mon Dec 20 22:01:05 2021 +0100

    Fortran: CASE selector expressions must be scalar

    gcc/fortran/ChangeLog:

            PR fortran/103776
            * match.c (match_case_selector): Reject expressions in CASE
            selector which are not scalar.

    gcc/testsuite/ChangeLog:

            PR fortran/103776
            * gfortran.dg/select_10.f90: New test.

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

* [Bug fortran/103776] ICE in gfc_compare_string, at fortran/arith.c:1118
  2021-12-20 17:51 [Bug fortran/103776] New: ICE in gfc_compare_string, at fortran/arith.c:1118 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2021-12-22 19:09 ` cvs-commit at gcc dot gnu.org
@ 2021-12-22 19:11 ` anlauf at gcc dot gnu.org
  2021-12-27 20:17 ` cvs-commit at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-12-22 19:11 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

--- Comment #4 from anlauf at gcc dot gnu.org ---
Fixed for gcc-12.

Thanks for the report!

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

* [Bug fortran/103776] ICE in gfc_compare_string, at fortran/arith.c:1118
  2021-12-20 17:51 [Bug fortran/103776] New: ICE in gfc_compare_string, at fortran/arith.c:1118 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2021-12-22 19:11 ` anlauf at gcc dot gnu.org
@ 2021-12-27 20:17 ` cvs-commit at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-12-27 20:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Harald Anlauf
<anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:3c830e6d17b12aff2875b6e80e77774404f09153

commit r11-9419-g3c830e6d17b12aff2875b6e80e77774404f09153
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Mon Dec 20 22:01:05 2021 +0100

    Fortran: CASE selector expressions must be scalar

    gcc/fortran/ChangeLog:

            PR fortran/103776
            * match.c (match_case_selector): Reject expressions in CASE
            selector which are not scalar.

    gcc/testsuite/ChangeLog:

            PR fortran/103776
            * gfortran.dg/select_10.f90: New test.

    (cherry picked from commit 5474092c9afbd76cbd457facce3757d8d2fad07b)

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

end of thread, other threads:[~2021-12-27 20:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-20 17:51 [Bug fortran/103776] New: ICE in gfc_compare_string, at fortran/arith.c:1118 gscfq@t-online.de
2021-12-20 20:03 ` [Bug fortran/103776] " anlauf at gcc dot gnu.org
2021-12-20 21:08 ` anlauf at gcc dot gnu.org
2021-12-22 19:09 ` cvs-commit at gcc dot gnu.org
2021-12-22 19:11 ` anlauf at gcc dot gnu.org
2021-12-27 20:17 ` cvs-commit 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).