* Correction: Seg fault when calling Fortran from C++
@ 2010-03-31 21:07 Glenn H Sembroski
0 siblings, 0 replies; only message in thread
From: Glenn H Sembroski @ 2010-03-31 21:07 UTC (permalink / raw)
To: gcc-help
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@purdue.edu
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-03-31 14:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-31 21:07 Correction: Seg fault when calling Fortran from C++ Glenn H Sembroski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).