[Fortran] Failing test fortranlib_test_F03 on big-endian 32-bit architectures with 64-bit time_t size #5206
Labels
Component - Build
CMake, Autotools
Component - Fortran
Fortran wrappers
Component - Testing
Code in test or testpar directories, GitHub workflows
Describe the bug
Debian has recently had a transition to 64-bit
time_t
size in order to avoid the year 2038 bug. See https://wiki.debian.org/ReleaseGoals/64bit-time.Since then the fortranlib_test_F03 test has been failing on big-endian 32-bit architectures with:
See e.g. https://buildd.debian.org/status/fetch.php?pkg=hdf5&arch=hppa&ver=1.14.5%2Brepack-2&stamp=1735623616&raw=0.
It appears that this failure is caused by the fortran function
h5gmtime()
always returning 01/01/1970.On 32-bit architectures, when
time_t
size is set to 64-bit,h5gmtime()
must call C function__gmtime64()
instead ofgmtime()
which is for 32-bittime_t
only.The fact that it affects big-endian 32-bit architectures only is because on little-endian the lower 32 bits of the 64-bit
time_t
value are stored in the first 4 bytes (and thus have the correct value).Expected behavior
Successful test.
Platform (please complete the following information)
--enable-fortran --enable-fortran2003 --enable-tests
Patch proposal
Please find attached a patch proposal which should work for both autotools and cmake build systems.
fortran_gmtime64.patch.gz
The text was updated successfully, but these errors were encountered: