diff mbox

[fortran] Fix PR 79312, find invalid typespec for empty array constructors

Message ID 9b07530f-b767-8cc7-48fa-067045034678@netcologne.de
State New
Headers show

Commit Message

Thomas Koenig July 24, 2017, 9:27 p.m. UTC
Hello world,

the attached patch fixes the PR; patch and test case are rather
self-explanatory.

Regression-testing as I write this.  OK for trunk if it passes?

Regards

	Thomas

2017-07-24  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-07-24  Thomas König  <tkoenig@gcc.gnu.org>

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

Comments

Thomas Koenig July 25, 2017, 10:04 a.m. UTC | #1
I wrote:

> Regression-testing as I write this.  OK for trunk if it passes?

Regression test passed.

Regards

	Thomas
Thomas Koenig Aug. 1, 2017, 3:09 p.m. UTC | #2
Am 24.07.2017 um 23:27 schrieb Thomas Koenig:
> Hello world,
> 
> the attached patch fixes the PR; patch and test case are rather
> self-explanatory.
> 
> Regression-testing as I write this.  OK for trunk if it passes?
> 
> Regards
> 
>      Thomas

OK?

Regards

	Thomas
Paul Richard Thomas Aug. 1, 2017, 5:46 p.m. UTC | #3
Hi Thomas,

This is 'obvious, I think. Yes, OK for trunk.

Thanks

Paul


On 1 August 2017 at 16:09, Thomas Koenig <tkoenig@netcologne.de> wrote:
> Am 24.07.2017 um 23:27 schrieb Thomas Koenig:
>>
>> Hello world,
>>
>> the attached patch fixes the PR; patch and test case are rather
>> self-explanatory.
>>
>> Regression-testing as I write this.  OK for trunk if it passes?
>>
>> Regards
>>
>>      Thomas
>
>
> OK?
>
> Regards
>
>         Thomas
diff mbox

Patch

Index: intrinsic.c
===================================================================
--- intrinsic.c	(Revision 249936)
+++ intrinsic.c	(Arbeitskopie)
@@ -4919,9 +4919,11 @@  gfc_convert_type_warn (gfc_expr *expr, gfc_typespe
   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;