[Fortran, patch] Disallow character(*) dummy arguments with VALUE attribute (PR30783)

Steve Kargl sgk@troutmask.apl.washington.edu
Sun Feb 18 19:35:00 GMT 2007


On Wed, Feb 14, 2007 at 09:51:45AM +0100, Tobias Burnus wrote:
> :ADDPATCH fortran:
> 
> As found when reading the VALUE implementation by Chris.
> 
> gfortran currently accepts "character(*), value", but it shouldn't:
> 
> a) the created programs crash
> 
> b) the standard disallows it:
> C528 (R501) If the VALUE attribute is specified, the length type
> parameter values shall be omitted or specified by initialization
> expressions.
> 
> The question is whether "character(10), value" is allowed. xlf, NAG f95
> and sunf95 reject it; gfortran, g95 and ifort accept it.
> 
> I couldn't find anything which disallows "(10)" and as gfortran produces
> the right result (both visually and according to valgrind), I think one
> can allow it. (g95 and ifort both produce wrong code; ifort crashes with
> SIGILL and g95 prints out only the first letter correctly [and valgrind
> complains about access to uninitialized memory].)
> 
> I didn't add a test case, if needed I could create one from my PR30783
> example.
> 
> Bootstrapped and regression tested on x86_64-unknown-linux-gnu.
> 
> Ok for the trunk (only as it is not in 4.2)?
> 

OK.

-- 
Steve



More information about the Fortran mailing list