public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Dominique d'Humières" <dominiq@lps.ens.fr>
To: fortran@gcc.gnu.org
Cc: Paul Richard Thomas <paul.richard.thomas@gmail.com>,
	       Steve Kargl <sgk@troutmask.apl.washington.edu>,
	       gcc-patches <gcc-patches@gcc.gnu.org>
Subject: [PATCH] PR 68283 [5/6 Regression] ice: gfc_variable_attr(): Bad array reference
Date: Sun, 24 Jan 2016 11:22:00 -0000	[thread overview]
Message-ID: <97D05D73-C68B-4E3E-ABE6-DEC94F43436C@lps.ens.fr> (raw)

Dear all,

Is the following patch OK for trunk and the gcc5 branch? see the thread starting at https://gcc.gnu.org/ml/fortran/2015-11/msg00057.html and https://gcc.gnu.org/ml/fortran/2015-11/msg00072.html.

Dominique

Index: gcc/fortran/ChangeLog
===================================================================
--- gcc/fortran/ChangeLog	(revision 232774)
+++ gcc/fortran/ChangeLog	(working copy)
@@ -1,3 +1,9 @@
+2016-01-24  Dominique d'Humieres <dominiq@lps.ens.fr>
+
+	PR fortran/68283
+	* primary.c (gfc_variable_attr): revert revision r221955,
+	call gfc_internal_error only if there is no error.
+
 2016-01-24  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
 	PR fortran/66094
Index: gcc/fortran/primary.c
===================================================================
--- gcc/fortran/primary.c	(revision 232774)
+++ gcc/fortran/primary.c	(working copy)
@@ -2194,7 +2194,7 @@
 symbol_attribute
 gfc_variable_attr (gfc_expr *expr, gfc_typespec *ts)
 {
-  int dimension, codimension, pointer, allocatable, target, n;
+  int dimension, codimension, pointer, allocatable, target;
   symbol_attribute attr;
   gfc_ref *ref;
   gfc_symbol *sym;
@@ -2253,22 +2253,9 @@
 	  case AR_UNKNOWN:
 	    /* If any of start, end or stride is not integer, there will
 	       already have been an error issued.  */
-	    for (n = 0; n < ref->u.ar.as->rank; n++)
-	      {
-		int errors;
-		gfc_get_errors (NULL, &errors);
-		if (((ref->u.ar.start[n]
-		      && ref->u.ar.start[n]->ts.type == BT_UNKNOWN)
-		     ||
-		     (ref->u.ar.end[n]
-		      && ref->u.ar.end[n]->ts.type == BT_UNKNOWN)
-		     ||
-		     (ref->u.ar.stride[n]
-		      && ref->u.ar.stride[n]->ts.type == BT_UNKNOWN))
-		    && errors > 0)
-		  break;
-	      }
-	    if (n == ref->u.ar.as->rank)
+	    int errors;
+	    gfc_get_errors (NULL, &errors);
+	    if (errors == 0)
 	      gfc_internal_error ("gfc_variable_attr(): Bad array reference");
 	  }
 
Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog	(revision 232774)
+++ gcc/testsuite/ChangeLog	(working copy)
@@ -1,3 +1,8 @@
+2016-01-24  Dominique d'Humieres  <dominiq@lps.ens.fr>
+
+	PR fortran/68283
+	gfortran.dg/pr68283.f90: New test.
+
 2016-01-24  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
 	PR fortran/66094
Index: gcc/testsuite/gfortran.dg/pr68283.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr68283.f90	(nonexistent)
+++ gcc/testsuite/gfortran.dg/pr68283.f90	(working copy)
@@ -0,0 +1,15 @@
+! { dg-do compile }
+MODULE neb_utils
+  IMPLICIT NONE
+  INTEGER, PARAMETER :: dp=8
+  TYPE neb_var_type
+     REAL(KIND=dp), DIMENSION(:, :),  POINTER  :: xyz, int, wrk
+  END TYPE neb_var_type
+CONTAINS
+  SUBROUTINE get_neb_force()
+    INTEGER                                  :: i
+    TYPE(neb_var_type), POINTER              :: forces
+    REAL(KIND=dp), ALLOCATABLE, DIMENSION(:) :: dtmp1, wrk
+    dtmp1 = forces%wrk(:,i)-dot_product_band ! { dg-error "Symbol 'dot_product_band' at .1. has no IMPLICIT type" }
+  END SUBROUTINE get_neb_force
+END MODULE neb_utils

             reply	other threads:[~2016-01-24 11:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-24 11:22 Dominique d'Humières [this message]
2016-01-24 12:39 ` Paul Richard Thomas

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=97D05D73-C68B-4E3E-ABE6-DEC94F43436C@lps.ens.fr \
    --to=dominiq@lps.ens.fr \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=paul.richard.thomas@gmail.com \
    --cc=sgk@troutmask.apl.washington.edu \
    /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).