The program uninit_test.f90 contains a number of simple subroutines that check for various fortran compilers ability to detect uninitialised variables.
With gfortran use -ffpe-trap=zero,overflow,invalid -finit-real=snan -finit-derived
With Intel compilers (ifort and ifx) use -check all -init=snan -init=array
Derived types with allocation in subroutines match the style of CABLE code in the UM. ACCESS ESM1.5/6 uses pointers (case 14) while ACCESS-AM3 uses a mixture of pointers and allocatable components (cases 14 & 16).
In the table an X indicates that an error was raised.
| Case | gfortran 14.2 | ifort 2021.10.0 | ifx 2025.0.4 |
|---|---|---|---|
| 1: Scalar in main | X | X | X |
| 2: Static array in main | X | X | X |
| 3: Allocatable array in main | _ | X | X |
| 4: Pointer array in main | _ | X | _ |
| 5: Local scalar in a subroutine | X | X | X |
| 6: Module scalar | X | X | X |
| 7: Automatic array in subroutine | X | X | X |
| 8: Array in subroutine with dimension from module parameter | X | X | X |
| 9: Static module array | X | X | X |
| 10: Allocatable module array | _ | X | X |
| 11: Pointer module array | _ | X | _ |
| 12: Scalar component of a derived type | X | _ | _ |
| 13: Pointer array component of derived type | _ | X | _ |
| 14: Pointer array component of derived type (alloc in subroutine) | _ | _ | _ |
| 15: Allocatable array component of derived type | _ | X | X |
| 16: Allocatable array component of derived type (alloc in subroutine) | _ | _ | X |