I'm hitting an odd segmentation fault when related to these arrays. If I set NDEFHIS and NDEFAVG to 0, everything is fine. But if I choose a non-zero value, I'm getting a seg fault associated with assigning a value to these arrays (e.g., in output.F):
Code: Select all
HIS(ng)%files(Fcount)=TRIM(HIS(ng)%name)
Code: Select all
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image PC Routine Line Source
romsG_phys_202207 00000000032EC901 Unknown Unknown Unknown
romsG_phys_202207 00000000032EAA3B Unknown Unknown Unknown
romsG_phys_202207 0000000003294084 Unknown Unknown Unknown
romsG_phys_202207 0000000003293E96 Unknown Unknown Unknown
romsG_phys_202207 0000000003243389 Unknown Unknown Unknown
romsG_phys_202207 0000000003246976 Unknown Unknown Unknown
libpthread-2.17.s 00002B5E71FC5630 Unknown Unknown Unknown
romsG_phys_202207 0000000003255BFB Unknown Unknown Unknown
romsG_phys_202207 0000000003252729 Unknown Unknown Unknown
romsG_phys_202207 000000000327F477 Unknown Unknown Unknown
romsG_phys_202207 0000000001CFBC59 def_his_ 59 def_his.f90
romsG_phys_202207 00000000005113CB output_ 105 output.f90
romsG_phys_202207 0000000000417716 main3d_ 254 main3d.f90
romsG_phys_202207 000000000040CBD9 ocean_control_mod 167 ocean_control.f90
romsG_phys_202207 000000000040B696 MAIN__ 86 master.f90
romsG_phys_202207 000000000040B11E Unknown Unknown Unknown
libc-2.17.so 00002B5E723F8555 __libc_start_main Unknown Unknown
romsG_phys_202207 000000000040B029 Unknown Unknown Unknown
Code: Select all
IF (FoundError(exit_flag, NoError, 87, &
& "ROMS/Utility/def_his.F")) RETURN
ncname=HIS(ng)%name
!
IF (Master) THEN
IF (ldef) THEN
WRITE (stdout,10) ng, TRIM(ncname) ! <-- line 59 of def_his.f90
ELSE
WRITE (stdout,20) ng, TRIM(ncname)
END IF
END IF
Code: Select all
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image PC Routine Line Source
romsG_phys_202207 00000000032ECEF1 Unknown Unknown Unknown
romsG_phys_202207 00000000032EB02B Unknown Unknown Unknown
romsG_phys_202207 0000000003294674 Unknown Unknown Unknown
romsG_phys_202207 0000000003294486 Unknown Unknown Unknown
romsG_phys_202207 0000000003243979 Unknown Unknown Unknown
romsG_phys_202207 0000000003246F66 Unknown Unknown Unknown
libpthread-2.17.s 00002B2522EA6630 Unknown Unknown Unknown
romsG_phys_202207 00000000032561EB Unknown Unknown Unknown
romsG_phys_202207 0000000003252D19 Unknown Unknown Unknown
romsG_phys_202207 0000000003285EFC Unknown Unknown Unknown
romsG_phys_202207 0000000000511286 output_ 103 output.f90
romsG_phys_202207 0000000000417716 main3d_ 254 main3d.f90
romsG_phys_202207 000000000040CBD9 ocean_control_mod 167 ocean_control.f90
romsG_phys_202207 000000000040B696 MAIN__ 86 master.f90
romsG_phys_202207 000000000040B11E Unknown Unknown Unknown
libc-2.17.so 00002B25232D9555 __libc_start_main Unknown Unknown
romsG_phys_202207 000000000040B029 Unknown Unknown Unknown
Code: Select all
IF (Master) THEN
WRITE (HIS(ng)%name,10) TRIM(HIS(ng)%base), ifile
10 FORMAT (a,'_',i5.5,'.nc')
END IF
print *, "TRIM(HIS(ng)%name)=", TRIM(HIS(ng)%name)
HIS(ng)%files(Fcount)=TRIM(HIS(ng)%name)
print *, "TRIM(HIS(ng)%name)=", TRIM(HIS(ng)%name) ! <-- line 103 of output.f90
IF (HIS(ng)%ncid.ne.-1) THEN
CALL netcdf_close (ng, iNLM, HIS(ng)%ncid)
END IF
CALL def_his (ng, NewFile)
I'm assuming that the actual error is related to something I broke during biogeochemical module development, but once again, the true mistake seems to be well away from the symptom. I'd like to track the HIS(ng)%files array to see where the memory is getting incorrectly deallocated (or never allocated in the first place?), but I can't seem to find those places in the code. Any advice appreciated!