This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Strange segmentation fault
- To: gcc-bugs at gcc dot gnu dot org
- Subject: Strange segmentation fault
- From: Bernard Heymann <bernard at calvin dot niams dot nih dot gov>
- Date: Mon, 02 Oct 2000 18:59:24 -0400
- Organization: LSBR, NIAMS, NIH
- Reply-to: bernard at calvin dot niams dot nih dot gov
We are baffled by a problem that cropped up in one of our Fortran
programs compiled using g77, which compiles and runs when compiled with
the IRIX MIPSpro f90 compiler or the VMS Fortran compiler. When we call
a subroutine with arguments required to dimension an array, we get a
segmentation fault in the subroutine call. Decreasing the size of the
array being dimensioned below a certain threshold solved the problem.
However, we need larger arrays in the original program, which works on
other platforms.
We extracted the relevant code and reproduced the problem (code given
below). We also tried using GDB, which just confirmed that the problem
lies in the subroutine call. We also tried the original program on an
i386 PC running Redhat Linux 6.2, getting the same segmentation fault.
This convinced us that the problem lies in the compiler.
GCC version: egcs-2.91.66
Machine: DEC Alpha Station 600
Operating system: Redhat Linux 6.2
Compilation command line:
g77 -g --save-temps test.f -o test
----------------------------------------------------------
PROGRAM TEST
C
IMPLICIT NONE
C
PRINT *, 'Start program TEST'
call dummy (127, 127)
C
END
C
subroutine dummy (ncol, nrow)
C
implicit none
C
integer*4 ncol, nrow
real*4 dummy1(ncol*nrow*130) ! This crashes
c real*4 dummy1(ncol*nrow*129) ! This works
C real*4 dummy1(127*127*130) ! This works
C
print *, 'What is going on here!!!!?'
C
end
----------------------------------------------------------
Bernard
begin:vcard
n:Heymann;Bernard
tel;fax:301-480-7629
tel;home:301-897-9310
tel;work:301-496-3988
x-mozilla-html:FALSE
org:NIH;LSBR, NIAMS
version:2.1
email;internet:bernard@calvin.niams.nih.gov
adr;quoted-printable:;;Bldg 6, Rm B2-34=0D=0A6 Center Drive MSC2717=0D=0ANIH;Bethesda;MD;20892-2717;USA
x-mozilla-cpt:;3
fn:Bernard Heymann
end:vcard