Commit ff33f38
authored
Fix core uninitialized values causing undefined behavior (wrf-model#2300)
TYPE: bugfix
KEYWORDS: uninitialized
SOURCE: internal
DESCRIPTION OF CHANGES:
Problem:
The domain type `fieldlist` is a derived type used to store state vars
within the `grid`. Thus, this type facilitates many of the read, write,
and general control of state variables defined within the registry.
Throughout the code, character fields such as `MemoryOrder` are accessed
and read to determine branching logic for how a particular state var
should be handled. Not all fields are required to be defined within the
registry, and this leads to uninitialized values within a newly created
instance of `fieldlist`.
Solution:
Rather than correcting the registry generated code that assigns state
vars, a better solution is to fix the upstream type definition to always
start with initialized default vales.
This fixes sporadic undefined behavior arising from accessing these
fields, sometimes resulting in total model crash or indefinite hangs as
MPI synchronization calls take different branching logic.1 parent f315dce commit ff33f38
1 file changed
Lines changed: 11 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| |||
0 commit comments