Pb mixing C & Fortran IO
ALLEON Guillaume
alleon@club-internet.fr
Sat May 8 02:26:00 GMT 1999
I forgot to mention that I use egcs 2.91.60 (egcs-1.1.1 release)
Guillaume
ALLEON Guillaume wrote:
> I encounter a problem when mixing C and Fortran IO in my code. Here are samples that
> reproduce the problem :
>
> ----- testc.c
>
> #include <stdio.h>
> main()
> {
> double a = 2.;
>
> doprint_(&a);
>
> printf("In c, a = %lf\n", a);
>
> return 0;
> }
>
> ---- testf.f
> subroutine doprint(aa)
> implicit none
> double precision aa
> c
> print*, "in Fortran, a = ", aa
> c aa = aa + 2.
> c
> return
> end
>
> [root@maverick /tmp]# g77 -c testf.f
> [root@maverick /tmp]# gcc -c testc.c
> [root@maverick /tmp]# gcc -o testc testc.o testf.o -lg2c
> [root@maverick /tmp]# ./testc
> Segmentation fault (core dumped)
> [root@maverick /tmp]# g77 -o testf testc.o testf.o
> [root@maverick /tmp]# ./testf
> Segmentation fault (core dumped)
> [root@maverick /tmp]#
>
> Any idea or fix ?
>
> Thanks
>
> Guillaume
More information about the Gcc-bugs
mailing list