This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch, fortran] Fix PR41235, accepts invalid


On Wednesday 09 December 2009 11:58:38 you wrote:
> On 12/08/2009 08:42 PM, Daniel Franke wrote:
> > Attached patch fixes PR41235, functions with non-constant string length
> > as a return type require an explicit interface.
> >
> > No new testcase as this is already included in
> > gfortran.dg/auto_char_len_4.f90
> >
> > 	* gfortran.dg/auto_char_len_4.f90: Check for additional error.
> 
> I am a bit lost. 

And rightly so.

Ignore the last patch, try this updated one instead. The place in interface.c 
was wrong and the required check is actually already present in resolve.c 
(resolve_fl_procedure) - it just didn't apply in the reporters case. Changed 
to check for unknown interfaces instead of explicitely marked external 
procedures - the entry_master check is to silence entry_17.f90.

Regression tested on i686-pc-linux-gnu. Ok for trunk (with updated ChangeLog 
and testcase from PR)?

Cheers

	Daniel
Index: resolve.c
===================================================================
--- resolve.c	(revision 155099)
+++ resolve.c	(working copy)
@@ -9047,7 +9047,9 @@ resolve_fl_procedure (gfc_symbol *sym, i
 	      return FAILURE;
 	    }
 
-	  if (sym->attr.external && sym->formal == NULL
+	  if (sym->attr.function
+	      && !sym->attr.entry_master
+	      && sym->attr.if_source == IFSRC_UNKNOWN
 	      && cl && cl->length && cl->length->expr_type != EXPR_CONSTANT)
 	    {
 	      gfc_error ("Automatic character length function '%s' at %L must "

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]