[Bug fortran/80118] [5/6/7/8 Regression] ICE with zero size parameter array
kargl at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Sep 20 00:20:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80118
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargl at gcc dot gnu.org
--- Comment #2 from kargl at gcc dot gnu.org ---
This seems to fix the problem.
Index: gcc/fortran/expr.c
===================================================================
--- gcc/fortran/expr.c (revision 252935)
+++ gcc/fortran/expr.c (working copy)
@@ -4568,7 +4568,7 @@ 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;
+ as = expr->symtree ? expr->symtree->n.sym->as : NULL;
for (ref = expr->ref; ref; ref = ref->next)
{
switch (ref->type)
Index: gcc/testsuite/gfortran.dg/pr80118.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr80118.f90 (nonexistent)
+++ gcc/testsuite/gfortran.dg/pr80118.f90 (working copy)
@@ -0,0 +1,10 @@
+! { dg-do compile }
+module m
+ implicit none
+ integer, parameter :: empty2(0) = 0
+ contains
+ subroutine sub(v)
+ integer, allocatable, intent(out) :: v(:)
+ v = 2 * empty2 ! This caused an internal compiler error.
+ end subroutine sub
+end module m
More information about the Gcc-bugs
mailing list