[Bug fortran/83318] Illegal program causes internal compiler error with tags gfc_trans_allocate, at fortran/trans-stmt.c:5646 and Aborted (program f951)

2017-12-09 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83318

kargl at gcc dot gnu.org changed:

   What|Removed |Added

   Priority|P3  |P4
 Status|NEW |RESOLVED
Version|5.4.0   |8.0
 Resolution|--- |FIXED
   Target Milestone|--- |8.0

--- Comment #7 from kargl at gcc dot gnu.org ---
Fixed on truck.  Thanks for the bug report.

[Bug fortran/83318] Illegal program causes internal compiler error with tags gfc_trans_allocate, at fortran/trans-stmt.c:5646 and Aborted (program f951)

2017-12-09 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83318

--- Comment #6 from kargl at gcc dot gnu.org ---
Author: kargl
Date: Sat Dec  9 19:53:55 2017
New Revision: 255524

URL: https://gcc.gnu.org/viewcvs?rev=255524=gcc=rev
Log:
2017-12-09  Steven G. Kargl  

PR fortran/82934
PR fortran/83318
* match.c (gfc_match_allocate): Enforce F2008:C631.

2017-12-09  Steven G. Kargl  

PR fortran/82934
PR fortran/83318
* gfortran.dg/allocate_assumed_charlen_2.f90: new test.

Added:
trunk/gcc/testsuite/gfortran.dg/allocate_assumed_charlen_2.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/match.c
trunk/gcc/testsuite/ChangeLog

[Bug fortran/83318] Illegal program causes internal compiler error with tags gfc_trans_allocate, at fortran/trans-stmt.c:5646 and Aborted (program f951)

2017-12-07 Thread sgk at troutmask dot apl.washington.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83318

--- Comment #5 from Steve Kargl  ---
I don't know how I missed F2008:C631

C631 (R626) A type-param-value in a type-spec shall be an asterisk if
   and only if each allocate-object is a dummy argument for which the
   corresponding type parameter is assumed.

This is going to make the fix real ugly.  Each alloc-object needs
to be checked that it is assumed length.

[Bug fortran/83318] Illegal program causes internal compiler error with tags gfc_trans_allocate, at fortran/trans-stmt.c:5646 and Aborted (program f951)

2017-12-07 Thread sgk at troutmask dot apl.washington.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83318

--- Comment #4 from Steve Kargl  ---
On Thu, Dec 07, 2017 at 11:42:53PM +, kargl at gcc dot gnu.org wrote:
> + if (!ts.u.cl->length)

Whoops.

  if (ts.type == BT_CHARACTER && !ts.u.cl->length)

[Bug fortran/83318] Illegal program causes internal compiler error with tags gfc_trans_allocate, at fortran/trans-stmt.c:5646 and Aborted (program f951)

2017-12-07 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83318

--- Comment #3 from kargl at gcc dot gnu.org ---
 gfcx -c a.f90
a.f90:5:13:

 allocate(character(len=*) :: string_array(2))
 1
Error: Type-spec at (1) must contain a scalar integer expression


Index: match.c
===
--- match.c (revision 255348)
+++ match.c (working copy)
@@ -4006,18 +4006,15 @@ gfc_match_allocate (void)
  goto cleanup;
}

- if (ts.type == BT_CHARACTER)
-   ts.u.cl->length_from_typespec = true;
-
- /* TODO understand why this error does not appear but, instead,
-the derived type is caught as a variable in primary.c.  */
- if (gfc_spec_list_type (type_param_spec_list, NULL) != SPEC_EXPLICIT)
+ if (!ts.u.cl->length)
{
- gfc_error ("The type parameter spec list in the type-spec at "
-"%L cannot contain ASSUMED or DEFERRED parameters",
-_locus);
+ gfc_error ("Type-spec at %L must contain a scalar integer "
+"expression", _locus);
  goto cleanup;
}
+
+ if (ts.type == BT_CHARACTER)
+   ts.u.cl->length_from_typespec = true;
}
   else
{

[Bug fortran/83318] Illegal program causes internal compiler error with tags gfc_trans_allocate, at fortran/trans-stmt.c:5646 and Aborted (program f951)

2017-12-07 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83318

kargl at gcc dot gnu.org changed:

   What|Removed |Added

 CC||kargl at gcc dot gnu.org
 Blocks|68241   |

--- Comment #2 from kargl at gcc dot gnu.org ---
Remove the reference to 68241.  len=* is not a deferred character length.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68241
[Bug 68241] [meta-bug] [F03] Deferred-length character

[Bug fortran/83318] Illegal program causes internal compiler error with tags gfc_trans_allocate, at fortran/trans-stmt.c:5646 and Aborted (program f951)

2017-12-07 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83318

Dominique d'Humieres  changed:

   What|Removed |Added

   Keywords||ice-on-invalid-code
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-12-07
 Blocks||68241
 Ever confirmed|0   |1

--- Comment #1 from Dominique d'Humieres  ---
Confirmed from 5.5.0 up to trunk (8.0).

The code is invalid, but an error would be better than an ICE.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68241
[Bug 68241] [meta-bug] [F03] Deferred-length character