diff mbox

[Fortran,F03] PR 58023: ICE on invalid with bad PPC declaration

Message ID CAKwh3qjO3KXBpfcr3wU25jQtD+fKsEw2vEKSFs2GL9FgKJOnBA@mail.gmail.com
State New
Headers show

Commit Message

Janus Weil Jan. 13, 2015, 9:18 p.m. UTC
Hi all,

the attached patch fixes an ICE-on-invalid problem with
procedure-pointer components by making sure that we continue resolving
all components of a derived type, even after an error is thrown.

Regtested on x86_64-unknown-linux-gnu. Ok for trunk?

Cheers,
Janus



2015-01-13  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/58023
    * resolve.c (resolve_fl_derived0): Continue resolving next component
    after error.

2015-01-13  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/58023
    * gfortran.dg/proc_ptr_comp_43.f90: New.

Comments

Mikael Morin Jan. 14, 2015, 2:17 p.m. UTC | #1
Hello Janus,

Le 13/01/2015 22:18, Janus Weil a écrit :
> Hi all,
> 
> the attached patch fixes an ICE-on-invalid problem with
> procedure-pointer components by making sure that we continue resolving
> all components of a derived type, even after an error is thrown.
> 
Does the fonction return false as before, whenever an error has been
issued?  I have the feeling it doesn't any more with the patch.

Mikael
diff mbox

Patch

Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c	(Revision 219552)
+++ gcc/fortran/resolve.c	(Arbeitskopie)
@@ -12389,7 +12389,7 @@  resolve_fl_derived0 (gfc_symbol *sym)
 	{
 	  gfc_error ("Coarray component %qs at %L must be allocatable with "
 		     "deferred shape", c->name, &c->loc);
-	  return false;
+	  continue;
 	}
 
       /* F2008, C443.  */
@@ -12398,7 +12398,7 @@  resolve_fl_derived0 (gfc_symbol *sym)
 	{
 	  gfc_error ("Component %qs at %L of TYPE(C_PTR) or TYPE(C_FUNPTR) "
 		     "shall not be a coarray", c->name, &c->loc);
-	  return false;
+	  continue;
 	}
 
       /* F2008, C444.  */
@@ -12409,7 +12409,7 @@  resolve_fl_derived0 (gfc_symbol *sym)
 	  gfc_error ("Component %qs at %L with coarray component "
 		     "shall be a nonpointer, nonallocatable scalar",
 		     c->name, &c->loc);
-	  return false;
+	  continue;
 	}
 
       /* F2008, C448.  */
@@ -12417,7 +12417,7 @@  resolve_fl_derived0 (gfc_symbol *sym)
 	{
 	  gfc_error ("Component %qs at %L has the CONTIGUOUS attribute but "
 		     "is not an array pointer", c->name, &c->loc);
-	  return false;
+	  continue;
 	}
 
       if (c->attr.proc_pointer && c->ts.interface)
@@ -12427,7 +12427,7 @@  resolve_fl_derived0 (gfc_symbol *sym)
 	  if (!sym->attr.vtype && !check_proc_interface (ifc, &c->loc))
 	    {
 	      c->tb->error = 1;
-	      return false;
+	      continue;
 	    }
 
 	  if (ifc->attr.if_source || ifc->attr.intrinsic)
@@ -12471,7 +12471,10 @@  resolve_fl_derived0 (gfc_symbol *sym)
 		  gfc_charlen *cl = gfc_new_charlen (sym->ns, ifc->ts.u.cl);
 		  if (cl->length && !cl->resolved
 		      && !gfc_resolve_expr (cl->length))
-		    return false;
+		    {
+		      c->tb->error = 1;
+		      continue;
+		    }
 		  c->ts.u.cl = cl;
 		}
 	    }
@@ -12514,7 +12517,7 @@  resolve_fl_derived0 (gfc_symbol *sym)
 			     "at %L has no argument %qs", c->name,
 			     c->tb->pass_arg, &c->loc, c->tb->pass_arg);
 		  c->tb->error = 1;
-		  return false;
+		  continue;
 		}
 	    }
 	  else
@@ -12528,7 +12531,7 @@  resolve_fl_derived0 (gfc_symbol *sym)
 			     "must have at least one argument",
 			     c->name, &c->loc);
 		  c->tb->error = 1;
-		  return false;
+		  continue;
 		}
 	      me_arg = c->ts.interface->formal->sym;
 	    }
@@ -12544,7 +12547,7 @@  resolve_fl_derived0 (gfc_symbol *sym)
 			 " the derived type %qs", me_arg->name, c->name,
 			 me_arg->name, &c->loc, sym->name);
 	      c->tb->error = 1;
-	      return false;
+	      continue;
 	    }
 
 	  /* Check for C453.  */
@@ -12554,7 +12557,7 @@  resolve_fl_derived0 (gfc_symbol *sym)
 			 "must be scalar", me_arg->name, c->name, me_arg->name,
 			 &c->loc);
 	      c->tb->error = 1;
-	      return false;
+	      continue;
 	    }
 
 	  if (me_arg->attr.pointer)
@@ -12563,7 +12566,7 @@  resolve_fl_derived0 (gfc_symbol *sym)
 			 "may not have the POINTER attribute", me_arg->name,
 			 c->name, me_arg->name, &c->loc);
 	      c->tb->error = 1;
-	      return false;
+	      continue;
 	    }
 
 	  if (me_arg->attr.allocatable)
@@ -12572,12 +12575,15 @@  resolve_fl_derived0 (gfc_symbol *sym)
 			 "may not be ALLOCATABLE", me_arg->name, c->name,
 			 me_arg->name, &c->loc);
 	      c->tb->error = 1;
-	      return false;
+	      continue;
 	    }
 
 	  if (gfc_type_is_extensible (sym) && me_arg->ts.type != BT_CLASS)
-	    gfc_error ("Non-polymorphic passed-object dummy argument of %qs"
-		       " at %L", c->name, &c->loc);
+	    {
+	      gfc_error ("Non-polymorphic passed-object dummy argument of %qs"
+			 " at %L", c->name, &c->loc);
+	      continue;
+	    }
 
 	}