Opps, I left a BIND(C) in my fortran code snippet that shouldn't be
there (I was trying this and that unsuccessfully to fix the problem. The
corrected problem description follows:
*****************************************************************************************
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)
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