This is the mail archive of the
mailing list for the GCC project.
Re: [Patch, fortran] PR29642 - Fortran 2003: VALUE Attribute (pass by value)
FX Coudert wrote:
>>>> + if ((a%x /= b%x) .or. (a%c /= b%c)) dtne = .TRUE.
>> Please replace the real/complex tests by something like
>> abs(a%x-b%x) > epsilon(a%x)
>> etc. Here it accidentally works, though.
> I have to say that I differ here. There's no arithmetic done on the
> variables here, so the values should really be exactly the same, and a
> simple /= operator is, IMHO, sufficient.
I agree that with no arithmetic they should be the same. Thus for
value_1.f90 leaving the /= is ok with me.
But for value_4.f90/value_4.c, where arithmetics are used, I had to use
abs() > epsilon() in order to get no abort.
[Except for the integer case where changing 3.0 to 3 was enough.]