[Bug fortran/91801] ICE in gfc_simplify_reshape, at fortran/simplify.c:6733

2019-10-10 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91801

kargl at gcc dot gnu.org changed:

   What|Removed |Added

   Priority|P3  |P4
 Status|NEW |RESOLVED
 Resolution|--- |FIXED
   Assignee|unassigned at gcc dot gnu.org  |kargl at gcc dot gnu.org
   Target Milestone|--- |9.3

--- Comment #5 from kargl at gcc dot gnu.org ---
Fixed on trunk and 9-brnach.  Closing.  Thanks for bug report.

[Bug fortran/91801] ICE in gfc_simplify_reshape, at fortran/simplify.c:6733

2019-10-10 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91801

--- Comment #4 from kargl at gcc dot gnu.org ---
Author: kargl
Date: Thu Oct 10 21:56:08 2019
New Revision: 276853

URL: https://gcc.gnu.org/viewcvs?rev=276853=gcc=rev
Log:
2019-10-10  Steven G. Kargl  

PR fortran/91801
* simplify.c (gfc_simplify_reshape): Convert a gcc_assert into a
gfc_error as a user can easily hit the condition.

2019-10-10  Steven G. Kargl  

PR fortran/91801
* gfortran.dg/pr91801.f90: New test.

Added:
branches/gcc-9-branch/gcc/testsuite/gfortran.dg/pr91801.f90
Modified:
branches/gcc-9-branch/gcc/fortran/ChangeLog
branches/gcc-9-branch/gcc/fortran/simplify.c
branches/gcc-9-branch/gcc/testsuite/ChangeLog

[Bug fortran/91801] ICE in gfc_simplify_reshape, at fortran/simplify.c:6733

2019-10-08 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91801

--- Comment #3 from kargl at gcc dot gnu.org ---
Author: kargl
Date: Tue Oct  8 16:31:16 2019
New Revision: 276706

URL: https://gcc.gnu.org/viewcvs?rev=276706=gcc=rev
Log:
2019-10-08  Steven G. Kargl  

PR fortran/91801
* simplify.c (gfc_simplify_reshape): Convert a gcc_assert into a
gfc_error as a user can easily hit the condition.

2019-10-08  Steven G. Kargl  

PR fortran/91801
* gfortran.dg/pr91801.f90: New test.

Added:
trunk/gcc/testsuite/gfortran.dg/pr91801.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/simplify.c
trunk/gcc/testsuite/ChangeLog

[Bug fortran/91801] ICE in gfc_simplify_reshape, at fortran/simplify.c:6733

2019-10-04 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91801

kargl at gcc dot gnu.org changed:

   What|Removed |Added

 CC||kargl at gcc dot gnu.org

--- Comment #2 from kargl at gcc dot gnu.org ---
(In reply to Thomas Koenig from comment #1)
> Should be easy to fix.

Likely, all of the gcc_assert()'s in gfc_simplify_reshape
should be gfc_error()'s.  This patch fixes the ICE for
this PR. (Watch for cut-n-paste tab corruption).

Index: gcc/fortran/simplify.c
===
--- gcc/fortran/simplify.c  (revision 276593)
+++ gcc/fortran/simplify.c  (working copy)
@@ -6762,7 +6762,15 @@ gfc_simplify_reshape (gfc_expr *source, gfc_expr *shap

  gfc_extract_int (e, [i]);

- gcc_assert (order[i] >= 1 && order[i] <= rank);
+ if (order[i] < 1 || order[i] > rank)
+   {
+ gfc_error ("Element with a value of %d in ORDER at %L must be "
+"in the range [1, ..., %d] for the RESHAPE intrinsic "
+"near %L", order[i], _exp->where, rank,
+_exp->where);
+ return _bad_expr;
+   }
+
  order[i]--;
  if (x[order[i]] != 0)
{

[Bug fortran/91801] ICE in gfc_simplify_reshape, at fortran/simplify.c:6733

2019-09-19 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91801

Thomas Koenig  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-09-19
 CC||tkoenig at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Thomas Koenig  ---
Should be easy to fix.