public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Thomas Koenig <tkoenig@netcologne.de>
To: "fortran@gcc.gnu.org" <fortran@gcc.gnu.org>,
	gcc-patches <gcc-patches@gcc.gnu.org>
Subject: [patch, fortran, committed] Fix PR 80118
Date: Sun, 24 Sep 2017 08:45:00 -0000	[thread overview]
Message-ID: <99b5e8c9-b1a9-b330-3b58-d04230425a2c@netcologne.de> (raw)

[-- 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)

                 reply	other threads:[~2017-09-24  8:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=99b5e8c9-b1a9-b330-3b58-d04230425a2c@netcologne.de \
    --to=tkoenig@netcologne.de \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).