------- Comment #6 from uttamp at us dot ibm dot com  2006-01-11 22:02 -------
Subject: Re:  another runtime error goes undetected

On Wed, 2006-01-11 at 09:07 +0000, pault at gcc dot gnu dot org wrote:
> 
> ------- Comment #5 from pault at gcc dot gnu dot org  2006-01-11 09:07 -------
> (In reply to comment #4)
> > This is not a bug.  gfortran behavior is identical to ifort.
> > 
> Actually, it is quite specifically NOT permitted by the standard. To quote
> 12.4.1.1:
> 
> "If a scalar dummy argument is of type default character, the length len of 
> the
> dummy argument shall be less than or equal to the length of the actual
> argument.  The dummy argument becomes associated with the leftmost len
> characters of the actual argument.  If an array dummy argument is of type
> default character, the restriction on the length is for the entire array and
> not for each array element."
> 
> The reason for this is obvious enough; try writing beyond len and you will
> eventually get a seg fault.
> 
> Uttam is quite correct to pick this out as a bug, although I am not sure that
> we want a runtime error, except when -fbounds-check is active.  This could be
> implemented, with advantage in trans-expr(gfc_conv_function_call) by copying
> over some of the code from trans-array.c.

Compile time check will be much better fix than the runtime.

> 
> As it happens, in building a fix for PRs 20881, 23308 & 25710, I am about to
> add "same file" argument checking, which is why I encountered this PR.  It 
> will
> fix Uttam's testcase but not the case where subroutine foo is truly external.
> 

- Uttam


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24886

Reply via email to