public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tobias Burnus <burnus@net-b.de>
To: gcc patches <gcc-patches@gcc.gnu.org>, gfortran <fortran@gcc.gnu.org>
Subject: [Patch, Fortran] PR 50163 - ICE with nonconst expr in init expr
Date: Tue, 23 Aug 2011 14:19:00 -0000	[thread overview]
Message-ID: <4E539C93.7070704@net-b.de> (raw)

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

The bug is a regression: An error was printed with 4.1.x but since 4.3.x 
one gets an ICE. [No idea what GCC 4.2 does.] The solution is simply: 
Returning if there is a MATCH_ERROR.

See PR (esp. comment 2) for a more detailed description:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50163#c0

Build and regtested on x86-64-linux.
OK for the trunk? And to which version should it be backported? Only 
4.6? Also 4.5? Or even 4.4?

Tobias

[-- Attachment #2: init-err-fix.diff --]
[-- Type: text/x-patch, Size: 1010 bytes --]

2011-08-23  Tobias Burnus  <burnus@net-b.de>

	PR fortran/50163
	* check_init_expr (check_init_expr): Return when an error occured.

2011-08-23  Tobias Burnus  <burnus@net-b.de>

	PR fortran/50163
	* gfortran.dg/initialization_28.f90: New.

diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index 9922094..b050b11 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -2481,6 +2481,9 @@ check_init_expr (gfc_expr *e)
 	    m = MATCH_ERROR;
 	  }
 
+	if (m == MATCH_ERROR)
+	  return FAILURE;
+
 	/* Try to scalarize an elemental intrinsic function that has an
 	   array argument.  */
 	isym = gfc_find_function (e->symtree->n.sym->name);
--- /dev/null	2011-08-23 07:28:57.751883742 +0200
+++ gcc/gcc/testsuite/gfortran.dg/initialization_28.f90	2011-08-23 14:02:02.000000000 +0200
@@ -0,0 +1,9 @@
+! { dg-do compile }
+!
+! PR fortran/50163
+!
+! Contributed by Philip Mason
+!
+character(len=2) :: xx ='aa'
+integer :: iloc=index(xx,'bb') ! { dg-error "has not been declared or is a variable" }
+end

             reply	other threads:[~2011-08-23 12:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-23 14:19 Tobias Burnus [this message]
2011-08-24 11:25 ` Mikael Morin
2011-08-24 14:23   ` Tobias Burnus
2011-08-25 17:42     ` Mikael Morin

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=4E539C93.7070704@net-b.de \
    --to=burnus@net-b.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).