repeated error messages

Steve Kargl sgk@troutmask.apl.washington.edu
Sun Dec 18 19:13:00 GMT 2011


On Sun, Dec 18, 2011 at 10:49:45AM -0800, Steve Kargl wrote:
> laptop:kargl[202] cat zxc.f90
> program foo
>   type bar
>     character(len=:), allocatable :: s
>   end type bar
> 
>   type(bar) bah
> 
>   bah%s = 'shoot'
> 
> end program foo
> laptop:kargl[203] 
> laptop:kargl[203] gfc4x -o z zxc.f90 
> zxc.f90:3.38:
> 
>     character(len=:), allocatable :: s
>                                       1
> Error: Deferred-length character component 's' at (1) is not yet supported
> zxc.f90:3.38:
> 
>     character(len=:), allocatable :: s
>                                       1
> Error: Deferred-length character component 's' at (1) is not yet supported
> 
> Can the repeated error message be suppressed?  If not,
> how about removing the error message, and letting gfortran
> ICE.

Here's a better patch.  No sense in continue to compile the code
if a component with a deferred type parameter is encountered.

Index: resolve.c
===================================================================
--- resolve.c	(revision 182454)
+++ resolve.c	(working copy)
@@ -11432,14 +11432,6 @@ resolve_fl_derived0 (gfc_symbol *sym)
 
   for (c = sym->components; c != NULL; c = c->next)
     {
-      /* See PRs 51550, 47545, 48654, 49050, 51075 - and 45170.  */
-      if (c->ts.type == BT_CHARACTER && c->ts.deferred)
-	{
-	  gfc_error ("Deferred-length character component '%s' at %L is not "
-		     "yet supported", c->name, &c->loc);
-	  return FAILURE;
-	}
-
       /* F2008, C442.  */
       if ((!sym->attr.is_class || c != sym->components)
 	  && c->attr.codimension
Index: trans-types.c
===================================================================
--- trans-types.c	(revision 182454)
+++ trans-types.c	(working copy)
@@ -2396,9 +2396,17 @@ gfc_get_derived_type (gfc_symbol * deriv
 	{
 	  if (c->ts.type == BT_CHARACTER)
 	    {
-	      /* Evaluate the string length.  */
-	      gfc_conv_const_charlen (c->ts.u.cl);
-	      gcc_assert (c->ts.u.cl->backend_decl);
+	      if (c->ts.deferred)
+		{
+#define DTPMSG "Component with deferred type parameter is unsupported"
+		  fatal_error (DTPMSG);
+		}
+	      else
+		{
+		  /* Evaluate the string length.  */
+		  gfc_conv_const_charlen (c->ts.u.cl);
+		  gcc_assert (c->ts.u.cl->backend_decl);
+		}
 	    }
 
 	  field_type = gfc_typenode_for_spec (&c->ts);


-- 
Steve



More information about the Fortran mailing list