Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fortran] Failing test fortranlib_test_F03 on big-endian 32-bit architectures with 64-bit time_t size #5206

Open
pini-gh opened this issue Jan 5, 2025 · 0 comments
Assignees
Labels
Component - Build CMake, Autotools Component - Fortran Fortran wrappers Component - Testing Code in test or testpar directories, GitHub workflows

Comments

@pini-gh
Copy link

pini-gh commented Jan 5, 2025

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:

Testing object functions                                                               PASSED
 h5ovisit_f FAILED
 h5ovisit_f FAILED
 h5ovisit_f FAILED
 h5ovisit_f FAILED
 h5ovisit_by_name_f FAILED
 h5ovisit_by_name_f FAILED
 Testing object visiting functions                                                     *FAILED*

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 of gmtime() which is for 32-bit time_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)

  • HDF5 version 1.14.5
  • OS and version Debian unstable on hppa or powerpc
  • Compiler and version gcc / gfortran 14.2.0
  • Build system (e.g. CMake, Autotools) autotools
  • Any configure options you specified --enable-fortran --enable-fortran2003 --enable-tests
  • MPI library and version (parallel HDF5) unrelevant

Patch proposal
Please find attached a patch proposal which should work for both autotools and cmake build systems.

fortran_gmtime64.patch.gz

@bmribler bmribler added Component - Fortran Fortran wrappers Component - Testing Code in test or testpar directories, GitHub workflows Component - Build CMake, Autotools labels Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component - Build CMake, Autotools Component - Fortran Fortran wrappers Component - Testing Code in test or testpar directories, GitHub workflows
Projects
None yet
Development

No branches or pull requests

3 participants