Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

forrtl: severe (174): SIGSEGV, segmentation fault occurred

Status
Not open for further replies.

Dabber2

Programmer
Oct 20, 2010
4
GB
Hi,

I am getting a segmentation fault after calling a subroutine:

forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image PC Routine Line Source
auroral_precip_bi 000000000040AED0 Unknown Unknown Unknown
auroral_precip_bi 0000000000402E83 Unknown Unknown Unknown
auroral_precip_bi 00000000004013FC Unknown Unknown Unknown
libc.so.6 00007F0D7DDCCC4D Unknown Unknown Unknown
auroral_precip_bi 00000000004012F9 Unknown Unknown Unknown

This error appears to occur when I try to write an integer to an output file. The subroutine up to the point of the error is:

SUBROUTINE IMF(in_yer, doy, sod, data_path, &

swvel, bt, cl_ang, bt_interp, sw_interp)

BYTE ,INTENT(IN) :: in_yer
CHARACTER*2 :: yr_str
INTEGER*4 ,INTENT(IN) :: doy
INTEGER*4 ,INTENT(IN) :: sod
INTEGER*2 :: yer, yr
INTEGER*4 :: dy
INTEGER*4 :: sd
INTEGER :: cross_year_flag = 0
INTEGER :: last_doy
INTEGER :: last_yr = 0
INTEGER :: no_imf_vals_pd
INTEGER :: intra_day_p, intra_day_m, intra_day
REAL, DIMENSION(370,60*24) :: swvel_arr, bt_arr, cl_ang_arr
REAL, DIMENSION(370,60*24) :: ly_swvel_arr, ly_bt_arr, ly_cl_ang_arr
REAL, DIMENSION(370,60*24) :: ny_swvel_arr, ny_bt_arr, ny_cl_ang_arr
REAL :: pi = 3.1415926
REAL :: mean_cos, mean_sin
REAL :: cl_ang, bt, swvel, cl_ang_temp
INTEGER, DIMENSION(370,60*24) :: bt_interp_arr, sw_interp_arr
INTEGER, DIMENSION(370,60*24) :: ny_bt_interp_arr, ly_bt_interp_arr
INTEGER, DIMENSION(370,60*24) :: ny_sw_interp_arr, ly_sw_interp_arr
CHARACTER(80), INTENT(IN) :: data_path

SAVE

WRITE(7,*) 'Entered IMF subroutine'
WRITE(7,*) 'sod: ', sod

My output file has the text 'Entered IMF subroutine' on the last line and there are no lines after that (not even a blank line). I'm running intel fortran version Version 12.0.3.174 on a linux machine, and have turned the compiler optimisation off with the -O0 flag. Does anyone have any ideas as to why it's crashing?
 
Ah, looks like the parameter 'sod' is not getting passed to my subroutine.
 
To avoid this kind of mistake, put your subroutines and functions into modules and USE the modules when you want to call one of its procedures.

The compiler, thank to the USE statement, will check automatically the number and the types of arguments.

François Jacq
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top