unknown instruction error... [message #11470] |
Fri, 10 April 1998 00:00 |
Richard G. French
Messages: 65 Registered: June 1997
|
Member |
|
|
Hi - I have been going crazy trying to track down a bug, and I have
succeeded in isolating it to a problem with restoring a savefile inside
of a procedure. I have constructed two test programs (attached)
this_works.pro
and
this_bombs.pro
Each of these programs has within it a routine to create a savefile,
which I have included so that you folks won't need to decode binary
files. Each program also reads a short data file. I can't make the
problem happen unless the data file is read. It is called
test.dat
On my DEC Alpha, running IDL 5.0.3, I get the following:
IDL> .run this_bombs
ABOUT TO BOMB....
% Stopped at unknown instruction(242) at 4294840816.
% Execution halted at: TEST2 15 this_bombs.pro
% $MAIN$ 57 this_bombs.pro
When i run the working version, I get:
IDL> .run this_works
insavefile=test.sav
worked fine
OK, fair enough. Now here is the strange part:
If I run this_bombs.pro to failure, and then say .go, it suddenly works:
IDL> .run this_bombs
ABOUT TO BOMB....
% Stopped on unknown instruction(242) at 4294840816.
% Execution halted at: TEST2 15 this_bombs.pro
% $MAIN$ 57 this_bombs.pro
IDL> .g
ABOUT TO BOMB....
ABOUT TO BOMB....
ABOUT TO BOMB....
ABOUT TO BOMB....
ABOUT TO BOMB....
IDL>
The differences between this_works.pro and this_bombs.pro are
only in order in which the savefile is restored and the data file
is read. The savefile does not have any variable names in it that
conflict with those in the routine that restores it.
I would really appreciate it if some of you would test this
and tell me if it bombs on your hardware. It seems to work on
without failure on the PC version of IDL. I can't see any
programming errors (elegance has been sacrificed to get a short
program that actually fails). I don't think I am breaking any
rules by restoring a savefile within a procedure.
Here are the files:
========test.dat - do not include this line ===============
nim dt (s)
0 0
1 164.51
2 178.14
3 180
4 181
======= cut here - do not include this line in data file
;================ this_bombs.pro starts here ===============
pro test2, insavefile, timing_file
restore, insavefile
string=''
openr,lun,/get_lun,timing_file
readf,lun,string
nim_arr=[-1]
dt_arr=[-1.d0]
nim=0L ; define as integer
while not eof(lun) do begin
readf,lun,nim,dt
nim_arr=[nim_arr,nim]
print,'ABOUT TO BOMB....'
dt_arr=[dt_arr,dt]
endwhile
free_lun,lun
end
; *********************** procedure to make a savefile
pro make_savefile
CATALOG_SAVEFILE = '../savefiles/6806C6V124_catalog3.sav'
CUBEFILE = '../data/6806C6V124.cube'
DR = 100.000
DTHETA = 0.100000
DTHETA_VALS =fltarr(800)
DU_KM =fltarr(28)
DV_KM =fltarr(28)
IF_MAX =fltarr(28)
LREBIN = 20
NR_VALS = 750
NTHETA_VALS = 800
RTHETA_CF = '../data/6806C6V124.rtheta.cube'
RTHETA_CUBEFILE = '../data/6806C6V124.rtheta.cube'
R_MAX = 145000.
R_MIN = 70000.0
R_VALS =fltarr(750)
SMOOTH_INTERP = 1
THETA_HALFRANGE = 40.0000
THETA_MAX = 130.000
THETA_MIN = 50.0000
TH_ANSAE =fltarr(28)
UCUBEFILE = '../data/6806C6V124.U.cube'
VCUBEFILE = '../data/6806C6V124.V.cube'
WHICH_IMAGES =intarr(26)
save,file='test.sav'
end
; *********** MAIN - this progam bombs
make_savefile ; this creates the savefile named below
insavefile = 'test.sav'
timing_file = 'test.dat'
test2, insavefile, timing_file
end
;=================end of this_bombs.pro
;=================this_works.pro starts here
pro test1, insavefile, timing_file
string=''
openr,lun,/get_lun,timing_file
readf,lun,string
nim_arr=[-1]
dt_arr=[-1.d0]
nim=0L ; define as integer
while not eof(lun) do begin
readf,lun,nim,dt
nim_arr=[nim_arr,nim]
dt_arr=[dt_arr,dt]
endwhile
free_lun,lun
print,'insavefile=',insavefile
restore, insavefile
print,'worked fine'
end
pro make_savefile
CATALOG_SAVEFILE = '../savefiles/6806C6V124_catalog3.sav'
CUBEFILE = '../data/6806C6V124.cube'
DR = 100.000
DTHETA = 0.100000
DTHETA_VALS =fltarr(800)
DU_KM =fltarr(28)
DV_KM =fltarr(28)
IF_MAX =fltarr(28)
LREBIN = 20
NR_VALS = 750
NTHETA_VALS = 800
RTHETA_CF = '../data/6806C6V124.rtheta.cube'
RTHETA_CUBEFILE = '../data/6806C6V124.rtheta.cube'
R_MAX = 145000.
R_MIN = 70000.0
R_VALS =fltarr(750)
SMOOTH_INTERP = 1
THETA_HALFRANGE = 40.0000
THETA_MAX = 130.000
THETA_MIN = 50.0000
TH_ANSAE =fltarr(28)
UCUBEFILE = '../data/6806C6V124.U.cube'
VCUBEFILE = '../data/6806C6V124.V.cube'
WHICH_IMAGES =intarr(26)
save,file='test.sav'
end
; *********** MAIN - this progam works fine
make_savefile
insavefile = 'test.sav'
timing_file = 'test.dat'
test1, insavefile, timing_file
end
|
|
|