Fwd: Help! Fortran call from C on LinuxPPC-R5

Franz Sirl Franz.Sirl-kernel@lauterbach.com
Thu Jul 15 15:02:00 GMT 1999


I looked at the generated code for f22.f a bit closer and I think it's totally
broken (the compiler even notices that, with -O2 all is optimized away :-) ).

Could one of the Fortran guys please look at this? I don't know where to start
here or if the the source is valid at all. I could even offer an account on a
Linux/PPC machine if necessary.

Franz.


Am Don, 15 Jul 1999 schrieb Franz Sirl:
>Hi,
>
>this was just reported on the linuxppc-dev list. R5 means that he is using 
>egcs-1.1.2, but I just verified that this is still present in gcc-2.95.
>
>Franz.
>
>
>>X-Mailer: Macintosh Eudora Pro Version 4.0.1Jr1
>>Date: Thu, 15 Jul 1999 17:57:42 +0900
>>To: linuxppc-dev@lists.linuxppc.org
>>From: "T.Ueda" <ueda@power.elec.kitami-it.ac.jp>
>>Subject: Help! Fortran call from C on LinuxPPC-R5
>>Sender: owner-linuxppc-dev@lists.linuxppc.org
>>X-Mailing-List: <linuxppc-dev@lists.linuxppc.org>
>>X-Loop: linuxppc-dev@lists.linuxppc.org
>>
>>Hi,
>>
>>I am checking a simple program that Fortran calls C  using LinuxPPC-R5 on 
>>PowerBookG3.
>>
>>It seems that real fuction call of fortran may wrong.
>>Why 2147482368.000000 in the case of calling real function?? ( real and 
>>float are not same bytes?)
>>
>>Anyone know the reason?
>>
>>
>>Tac@Japan
>>
>>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>[complile& run]
>>f77 -c f2.f
>>f77 -c f22.f
>>f77 -c f3.f
>>f77 -c f33.f
>>gcc main.c f2.o f22.o f3.o f33.o
>>a.out
>>Result: 5  --> 25  2147482368.000000  125   125.000000
>>
>>Why 2147482368.000000?? ( real and float are not same size?)
>>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>/*   (1)main.c  */
>>#include <stdio.h>
>>
>>int main() {
>>   float y22, y33;
>>   int x=5;
>>   int y2, y3;
>>
>>   y2=f2_(&x);
>>   y22=f22_(&x);
>>   f3_(&x, &y3);
>>   f33_(&x, &y33);
>>   printf("%d  --> %d  %f  %d   %f \n", x, y2, y22, y3, y33);
>>    return 0;
>>}
>>~~~~~~~~~~~~~~~~~~
>>C    (2)f2.f
>>     integer  function f2(x)
>>       integer x
>>       f2=x*x
>>       end
>>~~~~~~~~~~~~~~~~~~
>>C   (3) f22.f
>>       real function f22(x)
>>       integer x
>>       f22=x*x
>>       end
>>~~~~~~~~~~~~~~~~~~
>>C   (4) f3.f
>>       subroutine f3(x,y)
>>       integer x, y
>>       y=x*x*x
>>       end
>>~~~~~~~~~~~~~~~~~~
>>C   (5) f33.f
>>       subroutine f33(x,y)
>>       integer x
>>       real y
>>       y=x*x*x
>>       end
>>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


More information about the Gcc-bugs mailing list