This is the mail archive of the mailing 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]

Re: [Patch, fortran] PR29642 - Fortran 2003: VALUE Attribute (pass by value)


Many thanks for a thorough review - it does not seem to have been the best of my efforts; still there isn't much to do :-)
Standard is two spaces between date and name and between name and email

Mea culpa - too small a font or I nneed new glasses.You should add a test whether the VALUE variable is also a dummy

variable; currently,e.g.
program test
real, value :: a
end program test
gives no error.
"C515 (R501) The INTENT, VALUE, and OPTIONAL attributes may be specified
only for dummy arguments."
Bother, it's in my notes but I didn't check it off. I originally implemented it in resolve.c but scrubbed it as I decided to put the check in the matchers.
One should also add VALUE (and also VOLATILE) to:
case FL_LABEL:
(not found in the standard, but should be obvious; for VALUE probably
not needed if one requires "dummy".)
Indeed to the last remark.

VALUE should conflict with PARAMETER, EXTERNAL See: "C527 (R501) If the VALUE attribute is specified, the PARAMETER, EXTERNAL, POINTER, ALLOCATABLE, DIMENSION, VOLATILE, INTENT(INOUT), or INTENT(OUT) attribute shall not be specified."

Index: gcc/testsuite/gfortran.dg/value_1.f90
+ ! { dg-options "-std=gnu" }
Maybe better: "-std=f2003 -fall-intrinsics"
Why so?
+ if ((a%x /= b%x) .or. (a%c /= b%c)) dtne = .TRUE.
+ if (r /= 42.0) call abort ()
+ if (z /= (-99.0, 199.0)) call abort ()
+ if (r /= 42.0) call abort ()
+ if (r /= 99.0) call abort ()
+ if (z /= (-99.0, 199.0)) call abort ()
+ if (z /= (77.0, -42.0)) call abort ()
Please replace the real/complex tests by something like
abs(a%x-b%x) > epsilon(a%x)
etc. Here it accidentally works, though.
I agree with FX on this - these are comparisons of copies, so there is nothing accidental about it, nor indeed of my intention to have an exact test there.

Index: gcc/testsuite/gfortran.dg/value_3.f90
Please add a test like:
program x
real,value :: r
end program x
OK - ie. cf the above.

value_4.f90 + if ((2.0 * a).ne.b) call abort () This fails here. You should use something like: if(abs(2.0*a -b)>epsilon(a)) call abort()

Same for u and v, it should be something like:
 if (abs(4.0 * real(u)-real(v)) >epsilon(a) &
 .or.abs(4.0 * aimag(u)-aimag(v)) >epsilon(a) ) call abort ()

+ i_to_i__(long i1, long *i2)
+ return *i2 * 3.0;
This should be "3" not "3.0"
OK and thanks again.


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