#1152292 hdf5: testhdf5_fortran fails to link with LTO (GCC PR 117303)

Package:
hdf5
Source:
hdf5
Submitter:
Scot Breitenfeld
Date:
2026-10-29 15:46:04 UTC
Severity:
normal
Tags:
#1152292#5
Date:
2026-10-27 14:36:06 UTC
From:
To:
Dear Maintainer,

With LTO enabled, the build fails linking the Fortran test program:

 /usr/bin/ld: ...ltrans.o:(.rodata+0x58): undefined reference to `test_append_flush_callback'
 collect2: error: ld returned 1 exit status
 make[4]: *** [fortran/test/CMakeFiles/testhdf5_fortran.dir/build.make:333: bin/testhdf5_fortran] Error 1

fortran/test/tH5F_SWMR.F90 passes C_FUNLOC(test_append_flush_callback)
directly as an actual argument. gfortran stores the function address in
a static constant, and LTO does not see that as a reference, so it drops
the callback. This is GCC PR 117303
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117303), fixed in GCC 16
and on the gcc-15 branch.

Debian does not build with LTO by default, so the Debian build is not
affected. Ubuntu enables LTO by default, so Ubuntu builds of this
package fail. I hit it building 2.2.0+repack-5 for Ubuntu 24.04 (GCC 13).
Anyone building with DEB_BUILD_MAINT_OPTIONS=optimize=+lto and GCC 11 to
15 would hit it too.

The attached quilt patch assigns C_FUNLOC to a variable first, as the
other Fortran tests already do. It is the upstream fix
(https://github.com/HDFGroup/hdf5/pull/6794), so it can be dropped once
that is in a release.

Thanks,
Scot Breitenfeld
The HDF Group

#1152292#12
Date:
2026-10-29 15:44:35 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
hdf5, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 1152292@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Gilles Filippini <pini@debian.org> (supplier of updated hdf5 package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Thu, 29 Oct 2026 15:13:05 +0100
Source: hdf5
Architecture: source
Version: 2.2.0+repack-6
Distribution: unstable
Urgency: medium
Maintainer: Gilles Filippini <pini@debian.org>
Changed-By: Gilles Filippini <pini@debian.org>
Closes: 1040862 1149918 1152290 1152291 1152292
Changes:
 hdf5 (2.2.0+repack-6) unstable; urgency=medium
 .
   * Drop build-dependency on libcurl4-openssl-dev, unneeded as we don't
     enable ROS3 VFD which depends on aws-c-s3 (not in Debian yet)
     (closes: #1040862, #1149918)
   * Build-Depends on pkgconf, required by the hdf5 helper scripts
     (closes: #1152291)
   * hdf5-helper, libhdf5-{openmpi,mpich}-dev: Depends: pkgconf
     (requested bu h5cc et al; closes: #1152290)
   * New path from upstream PR 6794 to fix testhdf5_fortran link failure
     with LTO (closes: #1152292)
Checksums-Sha1:
 28d002a09aeaa47025841a8d91170f0209b61db1 3889 hdf5_2.2.0+repack-6.dsc
 bece325ed210bcf200c8238b41eac08018e2602e 167976 hdf5_2.2.0+repack-6.debian.tar.xz
 75f3ec95d2d6a37c3ddc8a03525410868b2829c6 33451 hdf5_2.2.0+repack-6_amd64.buildinfo
Checksums-Sha256:
 4043d8d7fcccaba1afc92b6eca9b67be4bfbf3919e6a5459dc96084fdb00653d 3889 hdf5_2.2.0+repack-6.dsc
 7d5098c8f2f8cd9b2126fc8cf407827c92a844d6d9f92c5384403677e02ef1cf 167976 hdf5_2.2.0+repack-6.debian.tar.xz
 056137a83489e339c7e062d14ddeeef8a138e0117c28de689190fff71ac9ebe8 33451 hdf5_2.2.0+repack-6_amd64.buildinfo
Files:
 f80206bfb05c4e324a41e32e4f02e6b9 3889 science optional hdf5_2.2.0+repack-6.dsc
 0b6565dfb48ed5c72ee12fc509964c6b 167976 science optional hdf5_2.2.0+repack-6.debian.tar.xz
 13072630c89aeb78c6d09410d588b7d5 33451 science optional hdf5_2.2.0+repack-6_amd64.buildinfo
-----BEGIN PGP SIGNATURE-----

iQFEBAEBCgAuFiEEoJObzArDE05WtIyR7+hsbH/+z4MFAmrjW1MQHHBpbmlAZGVi
aWFuLm9yZwAKCRDv6Gxsf/7Pgx3jCACGgTCkc30/tUqHCmORQhp/umJ+Xl/rsbcS
yDAr/jcZmBre22yNGi+PP/iu2GsdU3Pze0ZBb2LNxRequEBtdz6cIQ30D6oJhc/1
sXE+RX896elWsC1zFlrSCJBf2hwm7drVuXqN8DolM3JEsjDlF7PFdz4/SFlUHKVB
ymJeqznpLC/gmghxRPu/4CpTMSHYoFkRydv1nwUP0Fli0EWh78IXNav94f1n88cS
QP2du5nJm2BZzvS2vID16TCxu/NG3JEQZp/jTxp9SwdEv2KGQBMerbag7URBpmBH
n+qCv7KoW2Zc3qgyIhOV0Stbzusg+7hCnsF2UXIHBdg52HxCqCy2
=XIyj
-----END PGP SIGNATURE-----