Commit d8afd032 by Thomas Koenig

re PR fortran/79312 (Empty array in assignment not correctly type-checked)

2017-08-01  Thomas König  <tkoenig@gcc.gnu.org>

	PR fortran/79312
	* intrisic.c (gfc_convert_type_warn):  Only set typespec for
	empty array constructors which don't have it already.

2017-08-01  Thomas König  <tkoenig@gcc.gnu.org>

	PR fortran/79312
	* gfortran.dg/logical_assignment_1.f90:  New test.

From-SVN: r250792
parent e655a6cc
2017-08-01 Thomas König <tkoenig@gcc.gnu.org>
PR fortran/79312
* intrisic.c (gfc_convert_type_warn): Only set typespec for
empty array constructors which don't have it already.
2017-08-01 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/45435
......
......@@ -4919,9 +4919,11 @@ gfc_convert_type_warn (gfc_expr *expr, gfc_typespec *ts, int eflag, int wflag)
if (ts->type == BT_UNKNOWN)
goto bad;
/* NULL and zero size arrays get their type here. */
if (expr->expr_type == EXPR_NULL
|| (expr->expr_type == EXPR_ARRAY && expr->value.constructor == NULL))
/* NULL and zero size arrays get their type here, unless they already have a
typespec. */
if ((expr->expr_type == EXPR_NULL
|| (expr->expr_type == EXPR_ARRAY && expr->value.constructor == NULL))
&& expr->ts.type == BT_UNKNOWN)
{
/* Sometimes the RHS acquire the type. */
expr->ts = *ts;
......
2017-08-01 Thomas König <tkoenig@gcc.gnu.org>
PR fortran/79312
* gfortran.dg/logical_assignment_1.f90: New test.
2017-08-01 Martin Liska <mliska@suse.cz>
PR middle-end/70140
......
! { dg-do compile }
! PR 79312 - assigning a logical value to a real
! is invalid.
! Test case by John Harper.
program emptyarray5
implicit none
real a(0)
a = [logical::] ! { dg-error "Can't convert LOGICAL" }
print *,size(a)
end program emptyarray5
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