Silverfrost Forums

Welcome to our forums

Character Array A(1) can't be initialised in DATA

3 Dec 2010 5:25 #7201

I have a bit of old code where a number of character arrays are declared thus:

      CHARACTER*(30) A(10), B(10), C(1)

They are then initialised in DATA statements. C started out as 10 elements long as well, but as I never got round to using C(2) onwards, I must at some time around 1985 have reduced it to C(1), so that the DATA statement looks simply like:

      DATA C/'123456789012345678901234567890'/

If I compile without -O, the code compiles and runs correctly as far as I can tell. If I use -O, the code generates two errors:

Assumed-size errors cannot appear in a DATA statement

(which gives the line number of the DATA statement) and

C is an assumed-size array (bound of *), but is not an argument

which gives the line number of the declaration.

The workaround is to make C have the dimension (2), so it isn't serious, although I do have to put 30 useless characters in the data statement for C(2).

I'm using an old 4.90 version. Is this the same error fixed at 5.20 and referred to in the bugs fixed list under the note:

/OLD_ARRAYS gives a false error report when A(1) is not an argument

It is probably connected.

Regards

Eddie

4 Dec 2010 11:25 #7205

I have tested this on version 5.5/6.0 and the problem appears to have been fixed.

4 Dec 2010 12:07 #7207

Hi Paul,

It's me, sorry. I didn't realise that -O was '-Old_Arrays' not '-Optimise'. No blooming wonder!

Any way of removing this thread?

Eddie

Please login to reply.