Commit 8cad1ad5 by Steven G. Kargl

re PR fortran/91801 (ICE in gfc_simplify_reshape, at fortran/simplify.c:6733)

2019-10-08  Steven G. Kargl  <kargl@gcc.gnu.org>

	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  <kargl@gcc.gnu.org>

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

From-SVN: r276706
parent ff2640e5
2019-10-08 Steven G. Kargl <kargl@gcc.gnu.org>
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 Tobias Burnus <tobias@codesourcery.com> 2019-10-08 Tobias Burnus <tobias@codesourcery.com>
* parse.c (parse_executable): Add missing ST_OMP_TARGET_SIMD. * parse.c (parse_executable): Add missing ST_OMP_TARGET_SIMD.
......
...@@ -6762,7 +6762,15 @@ gfc_simplify_reshape (gfc_expr *source, gfc_expr *shape_exp, ...@@ -6762,7 +6762,15 @@ gfc_simplify_reshape (gfc_expr *source, gfc_expr *shape_exp,
gfc_extract_int (e, &order[i]); gfc_extract_int (e, &order[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], &order_exp->where, rank,
&shape_exp->where);
return &gfc_bad_expr;
}
order[i]--; order[i]--;
if (x[order[i]] != 0) if (x[order[i]] != 0)
{ {
......
2019-10-08 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/91801
* gfortran.dg/pr91801.f90: New test.
2019-10-08 Marek Polacek <polacek@redhat.com> 2019-10-08 Marek Polacek <polacek@redhat.com>
DR 685 - Integral promotion of enum ignores fixed underlying type. DR 685 - Integral promotion of enum ignores fixed underlying type.
......
! { dg-do compile }
! PR fortran/91801
! Code contributed by Gerhard Steinmetz
program p
integer, parameter :: a(2) = [2,0] ! { dg-error "Element with a value of" }
print *, reshape([1,2,3,4,5,6], [2,3], order=a) ! { dg-error "for the RESHAPE intrinsic near" }
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment