------- 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.

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.


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pault at gcc dot gnu dot org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-01-11 09:07:40
               date|                            |


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


Reply via email to