This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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]

Re: equivalence croakage


Hans Horn wrote:
> Steve Kargl wrote:
>> Please show the complete error message.
>> Please show the actual code causing the problem.
>> Please report the version of gfortran that you are using.
>> Please report the options that you used.
>>   
>
> I was using gfortran v4.5 and this WAS the entire error message!

It does not if you post complete code. As written before, the snippet of
code, which you posted before, works with gfortran.

> The legacy f77 code I was trying to compile was written in the early 90s.

Which does not mean that it is valid. As the error message of gfortran
indicates ("Overlapping unequal initializers in EQUIVALENCE") or the
warning of Open64 ("Warning: Multiple DATA initialization of storage for
.EQUIVA. Some initializations ignored."), your code has a problem:

You cannot initialize the same bit of storage by two different values -
it simply does not work. The compiler can either give an error (as
gfortran does), a warning (as Open64) or silently choose one of them for
initializing (as with ifort). I would argue that giving an error is
sensible, forcing the user to decide which initialization (s)he wants.

(There are several other features which make the code nonconforming to
the standard, but at least those extensions are non-ambiguous.)

> When I remove the initialization of ISTORE/0/, it compiles - surprise.

Why? You say that CSTORE(1), XSTORE and ISTORE share (at lease some of)
the bits as they are equivalenced.

You initialize "CSTORE(1)" with ' ' and ISTORE with 0 - what should the
compile now do? Use " "? Or "0" or one bit from CSTOR(1) followed by one
bit from ISTORE, followed by ... ?

> Would be nice to get an error message that tells what's wrong.
I would argue that the error message of gfortran and the warning of
Open64 are as clear as one get get. Or do you have a suggestion how the
error message can be improved?

Tobias


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