Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SAL: Explicitly allocate sht variable in SAL_CS
For reasons not entirely clear, deallocation of the RK2 control structure caused a segmentation fault when compiled by Nvidia. A deeper investigation suggested that the compiler was attempting to deallocate a nullified pointer during automatic cleanup of RK2->SAL->sht. Apparently deallocation of a NULL pointer is an error (even though free() is not supposed to care). By redefining `sht` as an allocatable component rather than a local component of the SAL_CS instance, it seemed to satisfy the compiler that nothing was needed and the error went away. There are still some lingering questions behind the cause of the segfault, but for now I am going to put this under "compiler bug". This patch also initializes some of the logical flags in the SAL_CS type. This is possibly unnecessary, but it is consistent with the general rules of safety followed in other MOM6 derived types.
- Loading branch information