public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/101565] New: ICE in gfc_simplify_image_index, at fortran/simplify.c:8234
@ 2021-07-21 17:49 gscfq@t-online.de
  2021-07-21 18:43 ` [Bug fortran/101565] " kargl at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: gscfq@t-online.de @ 2021-07-21 17:49 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101565
           Summary: ICE in gfc_simplify_image_index, at
                    fortran/simplify.c:8234
           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: ---

Non-integer array SUB affects versions down to at least r5 :
(z4 with a misleading error)


$ cat z1.f90
program p
   integer :: x[*]
   print *, image_index(x, [1.0])
end


$ cat z2.f90
program p
   integer :: x[*]
   print *, image_index(x, [.true.])
end


$ cat z3.f90
program p
   type t
      integer :: a
   end type
   integer :: x[*]
   print *, image_index(x, [t(1)])
end


$ cat z4.f90
program p
   integer :: x[*]
   print *, image_index(x, ['1'])
end


$ gfortran-12-20210718 -c z4.f90 -fcoarray=lib
z4.f90:3:24:

    3 |    print *, image_index(x, ['1'])
      |                        1
Error: Out of bounds in IMAGE_INDEX at (1) for dimension 1, SUB has 0 and
COARRAY lower bound is 1)


$ gfortran-12-20210718 -c z1.f90 -fcoarray=lib
f951: internal compiler error: Segmentation fault
0xe3985f crash_signal
        ../../gcc/toplev.c:328
0x7d59d2 gfc_simplify_image_index(gfc_expr*, gfc_expr*)
        ../../gcc/fortran/simplify.c:8234
0x753f73 do_simplify
        ../../gcc/fortran/intrinsic.c:4664
0x75e99a gfc_intrinsic_func_interface(gfc_expr*, int)
        ../../gcc/fortran/intrinsic.c:5050
0x7af8b9 resolve_unknown_f
        ../../gcc/fortran/resolve.c:2926
0x7af8b9 resolve_function
        ../../gcc/fortran/resolve.c:3270
0x7af8b9 gfc_resolve_expr(gfc_expr*)
        ../../gcc/fortran/resolve.c:7104
0x7b5cf4 gfc_resolve_expr(gfc_expr*)
        ../../gcc/fortran/resolve.c:7071
0x7b5cf4 gfc_resolve_code(gfc_code*, gfc_namespace*)
        ../../gcc/fortran/resolve.c:11832
0x7b463f gfc_resolve_blocks(gfc_code*, gfc_namespace*)
        ../../gcc/fortran/resolve.c:10851
0x7b4a08 gfc_resolve_code(gfc_code*, gfc_namespace*)
        ../../gcc/fortran/resolve.c:11822
0x7b7317 resolve_codes
        ../../gcc/fortran/resolve.c:17427
0x7b73de gfc_resolve(gfc_namespace*)
        ../../gcc/fortran/resolve.c:17462
0x79f924 resolve_all_program_units
        ../../gcc/fortran/parse.c:6403
0x79f924 gfc_parse_file()
        ../../gcc/fortran/parse.c:6655
0x7ecf1f gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:216

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

* [Bug fortran/101565] ICE in gfc_simplify_image_index, at fortran/simplify.c:8234
  2021-07-21 17:49 [Bug fortran/101565] New: ICE in gfc_simplify_image_index, at fortran/simplify.c:8234 gscfq@t-online.de
@ 2021-07-21 18:43 ` kargl at gcc dot gnu.org
  2021-11-29 21:32 ` anlauf at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: kargl at gcc dot gnu.org @ 2021-07-21 18:43 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
           Priority|P3                          |P4
   Last reconfirmed|                            |2021-07-21
     Ever confirmed|0                           |1

--- Comment #1 from kargl at gcc dot gnu.org ---
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index 27bf3a7eafe..e0162f16348 100644
--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -5970,6 +5970,13 @@ gfc_check_image_index (gfc_expr *coarray, gfc_expr *sub)
       return false;
     }

+  if (sub->ts.type != BT_INTEGER)
+    {
+      gfc_error ("Type of %s argument of IMAGE_INDEX at %L shall be INTEGER",
+                gfc_current_intrinsic_arg[1]->name, &sub->where);
+      return false;
+    }
+
   if (gfc_array_size (sub, &nelems))
     {
       int corank = gfc_get_corank (coarray);

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

* [Bug fortran/101565] ICE in gfc_simplify_image_index, at fortran/simplify.c:8234
  2021-07-21 17:49 [Bug fortran/101565] New: ICE in gfc_simplify_image_index, at fortran/simplify.c:8234 gscfq@t-online.de
  2021-07-21 18:43 ` [Bug fortran/101565] " kargl at gcc dot gnu.org
@ 2021-11-29 21:32 ` anlauf at gcc dot gnu.org
  2021-11-30 19:39 ` cvs-commit at gcc dot gnu.org
  2021-11-30 19:57 ` anlauf at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-11-29 21:32 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

--- Comment #2 from anlauf at gcc dot gnu.org ---
Packaged: https://gcc.gnu.org/pipermail/fortran/2021-November/057079.html

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

* [Bug fortran/101565] ICE in gfc_simplify_image_index, at fortran/simplify.c:8234
  2021-07-21 17:49 [Bug fortran/101565] New: ICE in gfc_simplify_image_index, at fortran/simplify.c:8234 gscfq@t-online.de
  2021-07-21 18:43 ` [Bug fortran/101565] " kargl at gcc dot gnu.org
  2021-11-29 21:32 ` anlauf at gcc dot gnu.org
@ 2021-11-30 19:39 ` cvs-commit at gcc dot gnu.org
  2021-11-30 19:57 ` anlauf at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-30 19:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:814f52a8bfc66aff8c453b040f0e730b034b7f52

commit r12-5634-g814f52a8bfc66aff8c453b040f0e730b034b7f52
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Mon Nov 29 22:23:02 2021 +0100

    Fortran: check type of SUB argument to IMAGE_INDEX

    gcc/fortran/ChangeLog:

            PR fortran/101565
            * check.c (gfc_check_image_index): Verify that SUB argument to
            IMAGE_INDEX is of type integer.

    gcc/testsuite/ChangeLog:

            PR fortran/101565
            * gfortran.dg/coarray_49.f90: New test.

    Co-authored-by: Steven G. Kargl <kargl@gcc.gnu.org>

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

* [Bug fortran/101565] ICE in gfc_simplify_image_index, at fortran/simplify.c:8234
  2021-07-21 17:49 [Bug fortran/101565] New: ICE in gfc_simplify_image_index, at fortran/simplify.c:8234 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2021-11-30 19:39 ` cvs-commit at gcc dot gnu.org
@ 2021-11-30 19:57 ` anlauf at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-11-30 19:57 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

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

Thanks for the report!

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

end of thread, other threads:[~2021-11-30 19:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-21 17:49 [Bug fortran/101565] New: ICE in gfc_simplify_image_index, at fortran/simplify.c:8234 gscfq@t-online.de
2021-07-21 18:43 ` [Bug fortran/101565] " kargl at gcc dot gnu.org
2021-11-29 21:32 ` anlauf at gcc dot gnu.org
2021-11-30 19:39 ` cvs-commit at gcc dot gnu.org
2021-11-30 19:57 ` anlauf 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).