Source-Code Workarounds

Workarounds for compiler bugs and limitations, documented inline in the Galacticus source.

gfortran PR 102845

Memory leak possibly due to OpenMP parallelism, or some failing of gfortran.

gfortran PR 105807

ICE when passing a derived type component to a class(*) function argument.

gfortran PR 110547

We use a pointer to self here rather than have self be passed to various methods (which are defined as “nopass” above) because otherwise gfortran calls the destructor of self on exit from these functions when using OpenMP task-based parallelism. This may be a compiler bug.

gfortran PR 110547

We use a pointer to self here rather than have self be passed to various methods (which are defined as “nopass” in the parent class) because otherwise gfortran calls the destructor of self on exit from these functions when using OpenMP task-based parallelism. This may be a compiler bug. Note that we use a separate pointer here that is not threadprivate as threadprivate variables can not be passed as arguments in untied OpenMP tasks.

gfortran PR 110548

We use an allocatable treeWalker here. Some subclasses will not need a treeWalker. Ideally this would therefore be passed to functions as an optional argument, but current optional arguments used in OpenMP tasks cause segfaults. Therefore, we instead use the allocation status of this variable as an indication of whether or not a treeWalker is needed.

gfortran PR 121537

gfortran misses a defined-assignment of a component.

gfortran PR 123938

gfortran causes a memory leak with allocatable components in nested derived-types.

gfortran PR 37336

Missing finalization of array constructors after their use in gfortran (PR#37336); workaround initializes the default names array using var_str before passing to inputParameter.

gfortran PR 37336

This function is needed to allow scaling of coordinate objects. It should not be needed as we overload the * and / operators for coordinate objects. But, until finalization is completed, function results are not finalized causing the overloaded * and / operators to leak memory. This is a workaround to avoid that.

gfortran PR 37336

Function results are not finalized after use. So, we must store the result of “cholesky*randoms” in a variable here (instead of just using this directly in the expression for “sample”) to avoid a memory leak. The variable “offsets” will be finalized when leaving this function scope.

gfortran PR 88632

importerUnitConvert is used by submodules, so must be exported to the object file. gfortran currently does not do this if the symbol is private, so we mark it as public.

gfortran PR 94446

Using the sizeof() intrinsic on a treeNode object causes a bogus “type mismatch” error when this module is used.

gfortran

Having names be allocatable in the following (which would be preferable) results in a memory leak on assignment. I have not been able to figure out why this happens. So, we make it a pointer array, and handle deallocation manually (and set forceArrayAssign above so that assignment is done, rather than just pointer assignment).

gfortran

Segfault triggered by inquire when running multiple OpenMP threads and a large number of MPI processes. Cause unknown. To workaround this we use the POSIX access() function to test for file existence.