This is the mail archive of the gcc-patches@gcc.gnu.org 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)


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


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