Seg fault when calling Fortran from C++

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,
I am having a problem where I get a segfault when my C++ main program calls a f77 entry point. I am using GCC4.1.2. The C++ is compiled with g++, the fortran with gfortran. I use the -ffixed-line-length-none -fno-automatic -fno-underscoring -fbounds-check options with gfortran. The code snippits look like:

C++:
 .
 .
 //Initalize the seed:
 int k1=0;
 int k2=0;
 int lux=3;
 cout<<primeSeed<<endl;
 rluxgo(&lux,&primeSeed,&k1,&k2);
 .
 .



Fortran (its really very old legacy code) :
   .
   .
C
C                    Entry to initialize from one or three integers
     ENTRY RLUXGO(LUX,INS,K1,K2) BIND(C)

        IF (LUX .LT. 0) THEN
           LUXLEV = LXDFLT
        ELSE IF (LUX .LE. MAXLEV) THEN
           LUXLEV = LUX
        ELSE IF (LUX .LT. 24 .OR. LUX .GT. 2000) THEN
   .
   .


I have stepped through this with gdb and the segfault occurs when I step into the rluxgo call . These files compiled and built with no problems. I have also compiled and built these same files using the Intel fortran compiler. That program ran with no problems.
Do I need a later version of GCC? Is there something else I need to do?
Thanks,

Glenn Sembroski
Physics Dept. , Purdue Univ.
sembrosk@xxxxxxxxxx








[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux