Commit b4cb2a41 by Steven G. Kargl

simplify.c (gfc_simplify_reshape): Convert assert into returning NULL, which…

simplify.c (gfc_simplify_reshape): Convert assert into returning NULL, which triggers an error condition.

2015-06-02  Steven G. Kargl  <kargl@gcc.gnu.org>

	* simplify.c (gfc_simplify_reshape): Convert assert into returning
	NULL, which triggers an error condition.

2015-06-02  Steven G. Kargl  <kargl@gcc.gnu.org>

	* gfortran.dg/reshape_7.f90: New test.

From-SVN: r224043
parent 6712d6fd
2015-06-02 Steven G. Kargl <kargl@gcc.gnu.org>
* simplify.c (gfc_simplify_reshape): Convert assert into returning
NULL, which triggers an error condition.
2015-05-27 Andre Vehreschild <vehre@gmx.de> 2015-05-27 Andre Vehreschild <vehre@gmx.de>
PR fortran/65548 PR fortran/65548
......
...@@ -5188,8 +5188,11 @@ gfc_simplify_reshape (gfc_expr *source, gfc_expr *shape_exp, ...@@ -5188,8 +5188,11 @@ gfc_simplify_reshape (gfc_expr *source, gfc_expr *shape_exp,
e = gfc_constructor_lookup_expr (source->value.constructor, j); e = gfc_constructor_lookup_expr (source->value.constructor, j);
else else
{ {
gcc_assert (npad > 0); if (npad <= 0)
{
mpz_clear (index);
return NULL;
}
j = j - nsource; j = j - nsource;
j = j % npad; j = j % npad;
e = gfc_constructor_lookup_expr (pad->value.constructor, j); e = gfc_constructor_lookup_expr (pad->value.constructor, j);
......
2015-06-02 Steven G. Kargl <kargl@gcc.gnu.org>
* gfortran.dg/reshape_7.f90: New test.
2015-06-02 David Malcolm <dmalcolm@redhat.com> 2015-06-02 David Malcolm <dmalcolm@redhat.com>
PR c/66220: PR c/66220:
......
! { dg-do compile }
! PR fortran/66380
!
subroutine p0
integer, parameter :: sh(2) = [2, 3]
integer, parameter :: &
& a(2,2) = reshape([1, 2, 3, 4], sh) ! { dg-error "Different shape" }
if (a(1,1) /= 0) call abort
end subroutine p0
subroutine p1
integer, parameter :: sh(2) = [2, 1]
integer, parameter :: &
& a(2,2) = reshape([1, 2, 3, 4], sh) ! { dg-error "Different shape" }
if (a(1,1) /= 0) call abort
end subroutine p1
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