[Fortran, patch] Disallow character(*) dummy arguments with VALUE attribute (PR30783)
Tobias Burnus
burnus@net-b.de
Wed Feb 14 17:10:00 GMT 2007
yyHi Chris,
Christopher D. Rickett wrote:
>> Tobias Burnus wrote:
>>
>>> As found when reading the VALUE implementation by Chris.
>>> gfortran currently accepts "character(*), value", but it shouldn't:
>>>
> did the fortran-experiments branch correctly handle this?
Yes and no. Your check for "(*)" was correct and inspired me to check
what Paul does, but you also prohibit initialization expressions with
value >1 for non-C-interop variables which are allowed -- and you ignore
the fact that VALUE can also be a statement:
integer(c_int) :: a
value :: a
In this case the check in decl.c's build_sym comes too early; it should
be in resolve.c's "resolve_symbol".
I will send soon an updated VALUE patch for fortran-experiments.
> i believe i added a check to correctly disallow this, because for C interop, the
> standard says further that the length is either omitted or "specified by
> an initialization expr whose value is one" (section 15.3.2, pg. 396:5-7).
> i'm not sure about the case where the string is not needed to be C
> interoperable though.
>
You are right about bind(c) but for VALUE outside C interop there is no
"whose value is one" restriction.
However, in my draft of the Fortran 2003 standard it is in 15.2.1. I have
http://www.j3-fortran.org/doc/year/04/04-007.pdf (J3/04-007; May 10)
Do you have an older version of the standard?
Actually, I don't have section 15.3.2 at all! The clause in 15.2 there
is at the end of the following paragraph:
"A Fortran intrinsic type with particular type parameter values is
interoperable with a C type if the type and kind type parameter value
are listed in the table on the same row as that C type; if the type is
character, interoperability also requires that the length type parameter
be omitted or be specified by an initialization expression whose value
is one."
Tobias
PS: I checked the corrigenda; while Corr. 1 has VALUE related changes,
they don't affect us yet as we do not yet the F2003 features class and pass.
More information about the Fortran
mailing list