public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/93364] [9/10 Regression] ICE in gfc_set_array_spec, at fortran/array.c:879
       [not found] <bug-93364-4@http.gcc.gnu.org/bugzilla/>
@ 2020-04-19 19:30 ` anlauf at gcc dot gnu.org
  2020-04-20 12:24 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-04-19 19:30 UTC (permalink / raw)
  To: gcc-bugs

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

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 ---
The following patch would avoid the ICE:

diff --git a/gcc/fortran/array.c b/gcc/fortran/array.c
index 57972bc9176..471523fb767 100644
--- a/gcc/fortran/array.c
+++ b/gcc/fortran/array.c
@@ -864,6 +864,10 @@ gfc_set_array_spec (gfc_symbol *sym, gfc_array_spec *as,
locus *error_loc)
       return false;
     }

+  /* Check F2018:C822.  */
+  if (sym->as->rank + sym->as->corank > GFC_MAX_DIMENSIONS)
+    goto too_many;
+
   if (as->corank)
     {
       sym->as->cotype = as->cotype;

I have a gut feeling that this kind of check should trigger earlier,
but cannot find this place.

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

* [Bug fortran/93364] [9/10 Regression] ICE in gfc_set_array_spec, at fortran/array.c:879
       [not found] <bug-93364-4@http.gcc.gnu.org/bugzilla/>
  2020-04-19 19:30 ` [Bug fortran/93364] [9/10 Regression] ICE in gfc_set_array_spec, at fortran/array.c:879 anlauf at gcc dot gnu.org
@ 2020-04-20 12:24 ` cvs-commit at gcc dot gnu.org
  2020-04-20 12:48 ` cvs-commit at gcc dot gnu.org
  2020-04-20 12:53 ` anlauf at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-20 12:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:aeb430aadc3c91af50095be924365981d85f8b8a

commit r10-7813-gaeb430aadc3c91af50095be924365981d85f8b8a
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Mon Apr 20 14:20:19 2020 +0200

    PR fortran/93364 - ICE in gfc_set_array_spec, at fortran/array.c:879

    Add missing check in gfc_set_array_spec for sum of rank and corank to not
    exceed GFC_MAX_DIMENSIONS.

    2020-04-20  Harald Anlauf  <anlauf@gmx.de>

            PR fortran/93364
            * array.c (gfc_set_array_spec): Check for sum of rank and corank
            not exceeding GFC_MAX_DIMENSIONS.

    2020-04-20  Harald Anlauf  <anlauf@gmx.de>

            PR fortran/93364
            * gfortran.dg/pr93364.f90: New test.

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

* [Bug fortran/93364] [9/10 Regression] ICE in gfc_set_array_spec, at fortran/array.c:879
       [not found] <bug-93364-4@http.gcc.gnu.org/bugzilla/>
  2020-04-19 19:30 ` [Bug fortran/93364] [9/10 Regression] ICE in gfc_set_array_spec, at fortran/array.c:879 anlauf at gcc dot gnu.org
  2020-04-20 12:24 ` cvs-commit at gcc dot gnu.org
@ 2020-04-20 12:48 ` cvs-commit at gcc dot gnu.org
  2020-04-20 12:53 ` anlauf at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-20 12:48 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:f32d02e223d49a5d9db295969da9d2c04dc9d086

commit r9-8516-gf32d02e223d49a5d9db295969da9d2c04dc9d086
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Mon Apr 20 14:45:10 2020 +0200

    PR fortran/93364 - ICE in gfc_set_array_spec, at fortran/array.c:879

    Backport from mainline.

    2020-04-20  Harald Anlauf  <anlauf@gmx.de>

    Add missing check in gfc_set_array_spec for sum of rank and corank to not
    exceed GFC_MAX_DIMENSIONS.

            PR fortran/93364
            * array.c (gfc_set_array_spec): Check for sum of rank and corank
            not exceeding GFC_MAX_DIMENSIONS.

            PR fortran/93364
            * gfortran.dg/pr93364.f90: New test.

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

* [Bug fortran/93364] [9/10 Regression] ICE in gfc_set_array_spec, at fortran/array.c:879
       [not found] <bug-93364-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2020-04-20 12:48 ` cvs-commit at gcc dot gnu.org
@ 2020-04-20 12:53 ` anlauf at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-04-20 12:53 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

--- Comment #5 from anlauf at gcc dot gnu.org ---
Fixed for gcc-10 and backported to 9-branch.

Thanks for the report.

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

end of thread, other threads:[~2020-04-20 12:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-93364-4@http.gcc.gnu.org/bugzilla/>
2020-04-19 19:30 ` [Bug fortran/93364] [9/10 Regression] ICE in gfc_set_array_spec, at fortran/array.c:879 anlauf at gcc dot gnu.org
2020-04-20 12:24 ` cvs-commit at gcc dot gnu.org
2020-04-20 12:48 ` cvs-commit at gcc dot gnu.org
2020-04-20 12:53 ` 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).