re PR fortran/80118 (ICE with zero size parameter array)

2017-09-24  Thomas Koenig  <tkoenig@gcc.gnu.org>
	    Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/80118
	* expr.c (gfc_get_full_arrayspec_from_expr): If there is
	no symtree, set array spec to NULL.

2017-09-24  Thomas Koenig  <tkoenig@gcc.gnu.org>
	    Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/80118
	* gfortran.dg/zero_sized_7.f90: New test.


Co-Authored-By: Steven G. Kargl <kargl@gcc.gnu.org>

From-SVN: r253123
This commit is contained in:
Thomas Koenig 2017-09-24 08:39:00 +00:00
parent e6a951d265
commit 650f7d09d2
4 changed files with 36 additions and 1 deletions

View file

@ -1,3 +1,10 @@
2017-09-24 Thomas Koenig <tkoenig@gcc.gnu.org>
Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/80118
* expr.c (gfc_get_full_arrayspec_from_expr): If there is
no symtree, set array spec to NULL.
2017-09-23 Janus Weil <janus@gcc.gnu.org>
PR fortran/82143

View file

@ -4568,7 +4568,11 @@ gfc_get_full_arrayspec_from_expr (gfc_expr *expr)
if (expr->expr_type == EXPR_VARIABLE
|| expr->expr_type == EXPR_CONSTANT)
{
as = expr->symtree->n.sym->as;
if (expr->symtree)
as = expr->symtree->n.sym->as;
else
as = NULL;
for (ref = expr->ref; ref; ref = ref->next)
{
switch (ref->type)

View file

@ -1,3 +1,9 @@
2017-09-24 Thomas Koenig <tkoenig@gcc.gnu.org>
Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/80118
* gfortran.dg/zero_sized_7.f90: New test.
2017-09-23 Janus Weil <janus@gcc.gnu.org>
PR fortran/82143

View file

@ -0,0 +1,18 @@
! { dg-do compile }
! PR 80118 - this used to ICE
! Original test case by Marco Restelli
module m
implicit none
integer, parameter :: not_empty(1) = 0
integer, parameter :: empty1(0) = (/integer :: /)
integer, parameter :: empty2(0) = 0
contains
subroutine sub(v)
integer, allocatable, intent(out) :: v(:)
v = 2*empty2 ! internal compiler error
end subroutine sub
end module m