Commit 650f7d09 by Thomas Koenig

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
parent e6a951d2
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> 2017-09-23 Janus Weil <janus@gcc.gnu.org>
PR fortran/82143 PR fortran/82143
......
...@@ -4568,7 +4568,11 @@ gfc_get_full_arrayspec_from_expr (gfc_expr *expr) ...@@ -4568,7 +4568,11 @@ gfc_get_full_arrayspec_from_expr (gfc_expr *expr)
if (expr->expr_type == EXPR_VARIABLE if (expr->expr_type == EXPR_VARIABLE
|| expr->expr_type == EXPR_CONSTANT) || 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) for (ref = expr->ref; ref; ref = ref->next)
{ {
switch (ref->type) switch (ref->type)
......
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> 2017-09-23 Janus Weil <janus@gcc.gnu.org>
PR fortran/82143 PR fortran/82143
......
! { 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
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