Opened 7 years ago
Closed 7 years ago
#1835 closed Bug (fixed)
Uninitialized variable nn_dttrc used in iom.F90
Reported by: | mdunphy | Owned by: | lovato |
---|---|---|---|
Priority: | low | Milestone: | |
Component: | OCE | Version: | v3.6 |
Severity: | Keywords: | ||
Cc: |
Description
Context
The variable nn_dttrc is not initialized when we run without TOP, however it's used in iom.F90, and gets flagged as making use of an uninitialized value.
Analysis
Instrumenting subroutine set_xmlatt in iom.F90 like this:
WRITE(*,*) "Calling iom_set_field_attr for field_definition"
WRITE(cl1,'(i1)') 1 ; CALL iom_set_field_attr('field_definition', freq_op=cl1'ts', freq_offset='0ts')
WRITE(*,*) "Calling iom_set_field_attr for SBC, ff_fsbc = ", nn_fsbc
WRITE(cl1,'(i1)') nn_fsbc ; CALL iom_set_field_attr('SBC' , freq_op=cl1'ts', freq_offset='0ts')
WRITE(*,*) "Calling iom_set_field_attr for SBC_scalar, ff_fsbc = ", nn_fsbc
WRITE(cl1,'(i1)') nn_fsbc ; CALL iom_set_field_attr('SBC_scalar' , freq_op=cl1'ts', freq_offset='0ts')
WRITE(*,*) "Calling iom_set_field_attr for ptrc_T, nn_dttrc = ", nn_dttrc
WRITE(cl1,'(i1)') nn_dttrc ; CALL iom_set_field_attr('ptrc_T' , freq_op=cl1'ts', freq_offset='0ts')
WRITE(*,*) "Calling iom_set_field_attr for diad_T, nn_dttrc = ", nn_dttrc
WRITE(cl1,'(i1)') nn_dttrc ; CALL iom_set_field_attr('diad_T' , freq_op=cl1'ts', freq_offset='0ts')
Gives prints like this:
Calling iom_set_field_attr for field_definition
Calling iom_set_field_attr for SBC, ff_fsbc = 1
Calling iom_set_field_attr for SBC_scalar, ff_fsbc = 1
Calling iom_set_field_attr for ptrc_T, nn_dttrc = -757026840
Calling iom_set_field_attr for diad_T, nn_dttrc = -757026840
I'm not sure if this causes any problems since TOP is off. The uninitialized value makes it way to XIOS so it may have some effect depending on what XIOS does with crazy values. At the very least, fixing this means fewer uninitialized variable reports/warnings.
Fix
We can initialize nn_dttrc = 1 where it is defined, patch attached.
Alternatively, we can put #ifdef key_top ... #endif around the calls to iom_set_field_attr with nn_dttrc.
Commit History (2)
Changeset | Author | Time | ChangeLog |
---|---|---|---|
8027 | lovato | 2017-05-15T18:04:37+02:00 | trunk : apply bugfix for ticket #1835 |
8026 | lovato | 2017-05-15T17:54:57+02:00 | 3.6 stable: solve ticket #1835 and add following fixes (tested with SETTE):
|
Attachments (1)
Change History (3)
Changed 7 years ago by mdunphy
comment:1 Changed 7 years ago by clevy
- Owner changed from nemo to lovato
comment:2 Changed 7 years ago by lovato
- Resolution set to fixed
- Status changed from new to closed
Code was updated for v3.6_stable at r8026 and trunk at r8027