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)


I send accidently the following email to Paul only.
Besides I found out something more in the meanwhile.

Tobias Burnus wrote [only to Paul]:
> Paul Thomas wrote:
>>> Problems:
>>> * value_4.c
>>> You use "f_to_f__" on my computer this does not work I need
>>> "f_to_f_" (one tailing underscore).  
>> That's with -ff2c ?  If so, something is badly wrong - this also implies
>> -fsecond-under-score.  Look at the dg-options line
> I think I messed up myself. The tests were failing, I tried it manually,
> missed -ff2c, and then the tests failed as well (but for different
> reasons). Sorry for the confusion I caused.
> I can confirm that with -ff2c it indeed compiles and that it then aborts
> during runtime.
> I have to change
>    long f_to_f__(long, long)
> to
>   int f_to_f__(int,int)
> (We really need ISO C bindings, I think; in the value_4.f90 "integer" is
> used)
If there are portability problems, one may concider to use:
"integer(4)" and "#include <sys/types.h>"/"int32_t" to make sure they
are compatible.

> In addition, for some reasons:
>   print *, b
>   b = f_to_f (a, c)
>   print *, b
> gives:
>    0.000000
>    0.000000
> Rather than "84.0". In value_4.c everything is still ok. (And the dumped
> tree looks also ok.)
The solution is to read the gfortran manpage. gfortran expects with
-ff2c that for "real" a "double" rather than a "float" is returned.
If I change the return value to "double" and keep the arguments as
"float" it works here.

If I read the IRC correctly, you (and Tobias S.) already know that.

In total:

The regression tests complete fine with the following changes:

value_1.f90: Changed acos(0.0) to "152.0" as -pedantic produces now
errors (acos() is not valid in Fortran 95 [but in Fortran 2003] and it
not yet recognized as allowed in gfortran -std=f2003.)

value_4.c: Changed
   extern long i_to_i__ (long, long*);
   extern int i_to_i__ (int, int*);
   extern float f_to_f__ (float, float*);
   extern double f_to_f__ (float, float*);


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