public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch, Fortran] PR 50163 - ICE with nonconst expr in init expr
@ 2011-08-23 14:19 Tobias Burnus
  2011-08-24 11:25 ` Mikael Morin
  0 siblings, 1 reply; 4+ messages in thread
From: Tobias Burnus @ 2011-08-23 14:19 UTC (permalink / raw)
  To: gcc patches, gfortran

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-08-25 16:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-23 14:19 [Patch, Fortran] PR 50163 - ICE with nonconst expr in init expr Tobias Burnus
2011-08-24 11:25 ` Mikael Morin
2011-08-24 14:23   ` Tobias Burnus
2011-08-25 17:42     ` Mikael Morin

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