diff mbox

[Fortran] PR 78573: [7 Regression] [OOP] ICE in resolve_component, at fortran/resolve.c:13405

Message ID CAKwh3qjSnijjCX9PoXF8YtdhgrsMKFA=RsKcsXping9t_+vP2Q@mail.gmail.com
State New
Headers show

Commit Message

Janus Weil Nov. 29, 2016, 9:58 p.m. UTC
Hi all,

here is a rather straightforward patch for an ice-on-invalid
regression. Regtests cleanly on x86_64-linux-gnu. Ok for trunk?

Cheers,
Janus



2016-11-29  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/78573
    * decl.c (build_struct): On error, return directly and do not build
    class symbol.

2016-11-29  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/78573
    * gfortran.dg/class_61.f90: New test case.

Comments

Steve Kargl Nov. 29, 2016, 10:21 p.m. UTC | #1
On Tue, Nov 29, 2016 at 10:58:35PM +0100, Janus Weil wrote:
> 
> here is a rather straightforward patch for an ice-on-invalid
> regression. Regtests cleanly on x86_64-linux-gnu. Ok for trunk?
> 

Yes.
Janus Weil Nov. 30, 2016, 7:27 a.m. UTC | #2
2016-11-29 23:21 GMT+01:00 Steve Kargl <sgk@troutmask.apl.washington.edu>:
> On Tue, Nov 29, 2016 at 10:58:35PM +0100, Janus Weil wrote:
>>
>> here is a rather straightforward patch for an ice-on-invalid
>> regression. Regtests cleanly on x86_64-linux-gnu. Ok for trunk?
>>
>
> Yes.

Thanks, Steve. Committed as r242996.

Cheers,
Janus
diff mbox

Patch

Index: gcc/fortran/decl.c
===================================================================
--- gcc/fortran/decl.c	(revision 242960)
+++ gcc/fortran/decl.c	(working copy)
@@ -1850,7 +1850,6 @@  build_struct (const char *name, gfc_charlen *cl, g
 {
   gfc_state_data *s;
   gfc_component *c;
-  bool t = true;
 
   /* F03:C438/C439. If the current symbol is of the same derived type that we're
      constructing, it must have the pointer attribute.  */
@@ -1952,7 +1951,7 @@  build_struct (const char *name, gfc_charlen *cl, g
 	{
 	  gfc_error ("Pointer array component of structure at %C must have a "
 		     "deferred shape");
-	  t = false;
+	  return false;
 	}
     }
   else if (c->attr.allocatable)
@@ -1961,7 +1960,7 @@  build_struct (const char *name, gfc_charlen *cl, g
 	{
 	  gfc_error ("Allocatable component of structure at %C must have a "
 		     "deferred shape");
-	  t = false;
+	  return false;
 	}
     }
   else
@@ -1970,20 +1969,15 @@  build_struct (const char *name, gfc_charlen *cl, g
 	{
 	  gfc_error ("Array component of structure at %C must have an "
 		     "explicit shape");
-	  t = false;
+	  return false;
 	}
     }
 
 scalar:
   if (c->ts.type == BT_CLASS)
-    {
-      bool t2 = gfc_build_class_symbol (&c->ts, &c->attr, &c->as);
+    return gfc_build_class_symbol (&c->ts, &c->attr, &c->as);
 
-      if (t)
-	t = t2;
-    }
-
-  return t;
+  return true;
 }