This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [Patch, fortran] PR29642 - Fortran 2003: VALUE Attribute (pass by value)
- From: Tobias Burnus <burnus at net-b dot de>
- To: Paul Thomas <paulthomas2 at wanadoo dot fr>
- Cc: Fortran List <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 18 Nov 2006 00:37:44 +0100
- Subject: Re: [Patch, fortran] PR29642 - Fortran 2003: VALUE Attribute (pass by value)
- References: <45599379.4010206@wanadoo.fr> <455E16F8.60806@wanadoo.fr>
Hi Paul,
>> 2006-11-14 Paul Thomas <pault@gcc.gnu.org>
Standard is two spaces between date and name and between name and email
address.
>> + conf (value, pointer)
>> + conf (value, allocatable)
>> + conf (value, subroutine)
>> + conf (value, function)
>> + conf (value, volatile_)
>> + conf (value, dimension)
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."
One should also add VALUE (and also VOLATILE) to:
case FL_PROGRAM:
case FL_BLOCK_DATA:
case FL_MODULE:
case FL_LABEL:
(not found in the standard, but should be obvious; for VALUE probably
not needed if one requires "dummy".)
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"
>> + 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.
>> Index: gcc/testsuite/gfortran.dg/value_3.f90
Please add a test like:
program x
real,value :: r
end program x
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 ()
value_4.c:
+ i_to_i__(long i1, long *i2)
+ return *i2 * 3.0;
This should be "3" not "3.0"
Tobias