PR fortran/68566
* array.c (match_array_element_spec): Add check for non-integer.
* simplify.c (gfc_simplify_reshape): If source shape is NULL return.
PR fortran/68566
* gfortran.dg/pr36192.f90: Update test.
* gfortran.dg/pr36192_1.f90: Update test.
* gfortran.dg/real_dimension_1.f: Update test.
* gfortran.dg/parameter_array_init_7.f90: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234864
138bc75d-0d04-0410-961f-
82ee72b054a4
+2016-04-09 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/68566
+ * array.c (match_array_element_spec): Add check for non-integer.
+ * simplify.c (gfc_simplify_reshape): If source shape is NULL return.
+
2016-04-06 Patrick Palka <ppalka@gcc.gnu.org>
PR c/70436
if (!gfc_expr_check_typed (*upper, gfc_current_ns, false))
return AS_UNKNOWN;
- if ((*upper)->expr_type == EXPR_FUNCTION && (*upper)->ts.type == BT_UNKNOWN
- && (*upper)->symtree && strcmp ((*upper)->symtree->name, "null") == 0)
- {
- gfc_error ("Expecting a scalar INTEGER expression at %C");
+ if (((*upper)->expr_type == EXPR_CONSTANT
+ && (*upper)->ts.type != BT_INTEGER) ||
+ ((*upper)->expr_type == EXPR_FUNCTION
+ && (*upper)->ts.type == BT_UNKNOWN
+ && (*upper)->symtree
+ && strcmp ((*upper)->symtree->name, "null") == 0))
+ {
+ gfc_error ("Expecting a scalar INTEGER expression at %C, found %s",
+ gfc_basic_typename ((*upper)->ts.type));
return AS_UNKNOWN;
}
if (!gfc_expr_check_typed (*upper, gfc_current_ns, false))
return AS_UNKNOWN;
- if ((*upper)->expr_type == EXPR_FUNCTION && (*upper)->ts.type == BT_UNKNOWN
- && (*upper)->symtree && strcmp ((*upper)->symtree->name, "null") == 0)
+ if (((*upper)->expr_type == EXPR_CONSTANT
+ && (*upper)->ts.type != BT_INTEGER) ||
+ ((*upper)->expr_type == EXPR_FUNCTION
+ && (*upper)->ts.type == BT_UNKNOWN
+ && (*upper)->symtree
+ && strcmp ((*upper)->symtree->name, "null") == 0))
{
- gfc_error ("Expecting a scalar INTEGER expression at %C");
+ gfc_error ("Expecting a scalar INTEGER expression at %C, found %s",
+ gfc_basic_typename ((*upper)->ts.type));
return AS_UNKNOWN;
}
|| !is_constant_array_expr (order_exp))
return NULL;
+ if (source->shape == NULL)
+ return NULL;
+
/* Proceed with simplification, unpacking the array. */
mpz_init (index);
+2016-04-09 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/68566
+ * gfortran.dg/pr36192.f90: Update test.
+ * gfortran.dg/pr36192_1.f90: Update test.
+ * gfortran.dg/real_dimension_1.f: Update test.
+ * gfortran.dg/parameter_array_init_7.f90: New test.
+
2016-04-09 John David Anglin <danglin@gcc.gnu.org>
PR testsuite/64039
--- /dev/null
+! { dg-do compile }
+! PR68566 ICE on using unusable array in reshape
+program p
+ integer, parameter :: n = 2
+ integer, parameter :: a(:) = 0 !{ dg-error "automatic or of deferred shape" }
+ integer, parameter :: b(n, n) = reshape([a, 1+a], [n, n])
+end
+
!
program three_body
real, parameter :: n = 2, d = 2
- real, dimension(n,d) :: x ! { dg-error "of INTEGER type|of INTEGER type" }
- x(1,:) = (/ 1.0, 0.0 /)
+ real, dimension(n,d) :: x ! { dg-error "Expecting a scalar INTEGER" }
+ x(1,:) = (/ 1.0, 0.0 /) ! { dg-error "Unclassifiable" }
end program three_body
-! { dg-prune-output "have constant shape" }
! PR fortran/36192
program three_body
real, parameter :: n = 2, d = 2
- real, dimension(n,d) :: x_hq ! { dg-error "of INTEGER type|of INTEGER type" }
+ real, dimension(n,d) :: x_hq ! { dg-error "Expecting a scalar INTEGER" }
call step(x_hq)
contains
subroutine step(x)
real, dimension(:,:), intent(in) :: x
end subroutine step
end program three_body
-! { dg-prune-output "must have constant shape" }
+! { dg-prune-output "Rank mismatch in argument" }
! { dg-do compile }
-! PR 34305 - make sure there's an error message for specifying a
+! PR 34305 - Test for specifying a real as dimension
program test
- parameter (datasize = 1000)
- dimension idata (datasize) ! { dg-error "must be of INTEGER type|must have constant shape" }
- idata (1) = -1
+ real , parameter :: dsize = 1000
+ dimension idata (dsize) ! { dg-error "scalar INTEGER expression" }
+ idata (1) = -1 ! { dg-error "must have the pointer attribute" }
end