This is the mail archive of the gcc-bugs@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]

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


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
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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