public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch, fortran, committed] Fix PR 80118
@ 2017-09-24  8:45 Thomas Koenig
  0 siblings, 0 replies; only message in thread
From: Thomas Koenig @ 2017-09-24  8:45 UTC (permalink / raw)
  To: fortran, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 672 bytes --]

Hello world,

Steve had analyzed the bug and provided a patch in the PR;
I modified the patch stylistically and committed it as
obvious after regression-testing (r253123).

Thanks Steve!

Since this is a regression, I will backport soon.

Regards

	Thomas

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.

[-- Attachment #2: zero_sized_7.f90 --]
[-- Type: text/x-fortran, Size: 394 bytes --]

! { 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

[-- Attachment #3: p1.diff --]
[-- Type: text/x-patch, Size: 503 bytes --]

Index: expr.c
===================================================================
--- expr.c	(Revision 253116)
+++ expr.c	(Arbeitskopie)
@@ -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)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-09-24  8:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-24  8:45 [patch, fortran, committed] Fix PR 80118 Thomas Koenig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).