Tobias Burnus - [Fortran, patch] Disallow character(*) dummy arguments with VALUE attri (original) (raw)

This is the mail archive of the gcc-patches@gcc.gnu.orgmailing 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]

: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)?

Tobias

2007-02-13 Tobias Burnus burnus@net-b.de

PR fortran/30783

Index: gcc/fortran/resolve.c

--- gcc/fortran/resolve.c (Revision 121891) +++ gcc/fortran/resolve.c (Arbeitskopie) @@ -6157,6 +6157,18 @@ return; }


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