[Bug fortran/86059] ICE in reduce_binary_ac, at fortran/arith.c:1308 (and others)

2018-06-09 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86059

kargl at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |7.4

--- Comment #5 from kargl at gcc dot gnu.org ---
Fixed on trunk and 7 and 8 branches.

[Bug fortran/86059] ICE in reduce_binary_ac, at fortran/arith.c:1308 (and others)

2018-06-09 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86059

--- Comment #4 from kargl at gcc dot gnu.org ---
Author: kargl
Date: Sat Jun  9 18:54:56 2018
New Revision: 261373

URL: https://gcc.gnu.org/viewcvs?rev=261373=gcc=rev
Log:
2018-06-09  Steven G. Kargl  

PR fortran/86059
* array.c (match_array_cons_element): NULL() cannot be in an
array constructor.

2018-06-09  Steven G. Kargl  

PR fortran/86059
* gfortran.dg/associate_30.f90: Remove code tested ...
* gfortran.dg/pr67803.f90: Ditto.
* gfortran.dg/pr67805.f90: Ditto.
* gfortran.dg/pr86059.f90: ... here.  New test.

Added:
branches/gcc-7-branch/gcc/testsuite/gfortran.dg/pr86059.f90
Modified:
branches/gcc-7-branch/gcc/fortran/ChangeLog
branches/gcc-7-branch/gcc/fortran/array.c
branches/gcc-7-branch/gcc/testsuite/ChangeLog
branches/gcc-7-branch/gcc/testsuite/gfortran.dg/associate_30.f90
branches/gcc-7-branch/gcc/testsuite/gfortran.dg/pr67803.f90
branches/gcc-7-branch/gcc/testsuite/gfortran.dg/pr67805.f90

[Bug fortran/86059] ICE in reduce_binary_ac, at fortran/arith.c:1308 (and others)

2018-06-09 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86059

--- Comment #3 from kargl at gcc dot gnu.org ---
Author: kargl
Date: Sat Jun  9 18:06:04 2018
New Revision: 261369

URL: https://gcc.gnu.org/viewcvs?rev=261369=gcc=rev
Log:
2018-06-09  Steven G. Kargl  

PR fortran/86059
* array.c (match_array_cons_element): NULL() cannot be in an
array constructor.

2018-06-09  Steven G. Kargl  

PR fortran/86059
* gfortran.dg/associate_30.f90: Remove code tested ...
* gfortran.dg/pr67803.f90: Ditto.
* gfortran.dg/pr67805.f90: Ditto.
* gfortran.dg/pr86059.f90: ... here.  New test.

Added:
branches/gcc-8-branch/gcc/testsuite/gfortran.dg/pr86059.f90
Modified:
branches/gcc-8-branch/gcc/fortran/ChangeLog
branches/gcc-8-branch/gcc/fortran/array.c
branches/gcc-8-branch/gcc/testsuite/ChangeLog
branches/gcc-8-branch/gcc/testsuite/gfortran.dg/associate_30.f90
branches/gcc-8-branch/gcc/testsuite/gfortran.dg/pr67803.f90
branches/gcc-8-branch/gcc/testsuite/gfortran.dg/pr67805.f90

[Bug fortran/86059] ICE in reduce_binary_ac, at fortran/arith.c:1308 (and others)

2018-06-08 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86059

--- Comment #2 from kargl at gcc dot gnu.org ---
Author: kargl
Date: Fri Jun  8 19:11:21 2018
New Revision: 261344

URL: https://gcc.gnu.org/viewcvs?rev=261344=gcc=rev
Log:
2018-06-08  Steven G. Kargl  

PR fortran/86059 
* array.c (match_array_cons_element): NULL() cannot be in an
array constructor.

2018-06-08  Steven G. Kargl  

PR fortran/86059 
* gfortran.dg/associate_30.f90: Remove code tested ...
* gfortran.dg/pr67803.f90: Ditto.
* gfortran.dg/pr67805.f90: Ditto.
* gfortran.dg/pr86059.f90: ... here.  New test.

Added:
trunk/gcc/testsuite/gfortran.dg/pr86059.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/array.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gfortran.dg/associate_30.f90
trunk/gcc/testsuite/gfortran.dg/pr67803.f90
trunk/gcc/testsuite/gfortran.dg/pr67805.f90

[Bug fortran/86059] ICE in reduce_binary_ac, at fortran/arith.c:1308 (and others)

2018-06-07 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86059

kargl at gcc dot gnu.org changed:

   What|Removed |Added

   Priority|P3  |P4
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-06-07
 CC||kargl at gcc dot gnu.org
   Assignee|unassigned at gcc dot gnu.org  |kargl at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from kargl at gcc dot gnu.org ---
I have a patch for this, but I need to spend time 
with the standard because I cannot find a prohibition
against NULL() in an array constructor (although it
makes absolutely no sense to allow it).

Watch for cut-n-paste tab corruption

Index: array.c
===
--- array.c (revision 261285)
+++ array.c (working copy)
@@ -1098,6 +1098,16 @@ match_array_cons_element (gfc_constructor_base *result
   if (m != MATCH_YES)
 return m;

+  if (expr->expr_type == EXPR_FUNCTION
+  && expr->ts.type == BT_UNKNOWN
+  && strcmp(expr->symtree->name, "null") == 0)
+   {
+  gfc_error ("NULL() at %L cannot appear in an array constructor",
+>where);
+  gfc_free_expr (expr);
+  return MATCH_ERROR;
+   }
+
   gfc_constructor_append_expr (result, expr, _current_locus);
   return MATCH_YES;
 }

 gfcx -c ~/tmp/a.f90
/safe/sgk/tmp/a.f90:2:32:

integer :: i(2) = [integer :: null(), 1]
1
Error: NULL() at (1) cannot appear in an array construct
/safe/sgk/tmp/a.f90:3:24:

integer :: j(2) = [1, null()]
1
Error: NULL() at (1) cannot appear in an array construct
/safe/sgk/tmp/a.f90:4:23:

integer :: k(2) = [(null(), n=1, 2)]
   1
Error: NULL() at (1) cannot appear in an array construct