#1108322 gcc-14: Fix broken ada timespec record with -D_TIME_BITS=64 on 32-bit big-endian targets

Package:
src:gcc-14
Source:
src:gcc-14
Submitter:
John David Anglin
Date:
2026-10-24 11:09:03 UTC
Severity:
normal
Tags:
#1108322#5
Date:
2025-06-25 21:22:52 UTC
From:
To:
Dear Maintainer,

The gnat patches applied to gcc-14 to support building with -D_TIME_BITS=64
-D_FILE_OFFSET_BITS=64 broke numerous tests in the gnat testsuite.

Analysis of the array39 test showed that the ada timespec record was
not correctly layed out.  See:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114065

In s-c_time.ads, we have

   type timespec is record
      tv_sec  : time_t range 0 .. OS_Constants.MAX_tv_sec;  --  seconds
      tv_nsec : nsec_t range 0 .. 999_999_999;              --  nanoseconds
   end record

but the struct __timespec64 is defined as follows:

#if __TIMESIZE == 64
# define __timespec64 timespec
#else
#include <endian.h>
/* The glibc Y2038-proof struct __timespec64 structure for a time value.
   To keep things Posix-ish, we keep the nanoseconds field a 32-bit
   signed long, but since the Linux field is a 64-bit signed int, we
   pad our tv_nsec with a 32-bit unnamed bit-field padding.

   As a general rule the Linux kernel is ignoring upper 32 bits of
   tv_nsec field.  */
struct __timespec64
{
  __time64_t tv_sec;         /* Seconds */
# if BYTE_ORDER == BIG_ENDIAN
  __int32_t :32;             /* Padding */
  __int32_t tv_nsec;         /* Nanoseconds */
# else
  __int32_t tv_nsec;         /* Nanoseconds */
  __int32_t :32;             /* Padding */
# endif
};
#endif

The nsec_t is currently defined using the size of the tv_nsec in
the __timespec 64 struct  but this ignores the padding on big-endian
targets.

The attached patch fixes this issue.

Regards,
Dave Anglin

#1108322#10
Date:
2025-07-28 17:35:47 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
gcc-14, 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 1108322@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Matthias Klose <doko@debian.org> (supplier of updated gcc-14 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: Mon, 28 Jul 2025 17:42:09 +0200
Source: gcc-14
Architecture: source
Version: 14.3.0-4
Distribution: experimental
Urgency: medium
Maintainer: Debian GCC Maintainers <debian-gcc@lists.debian.org>
Changed-By: Matthias Klose <doko@debian.org>
Closes: 1108322
Changes:
 gcc-14 (14.3.0-4) experimental; urgency=medium
 .
   * Update to git 20250728 from the gcc-14 branch.
     - Fix PR target/121027 (AArch64), PR target/118891 (AArch64),
       PR tree-optimization/118891, PR tree-optimization/121131,
       PR target/120908 (x86), PR target/120624 (AArch64),
       PR tree-optimization/116674, PR middle-end/120631, PR middle-end/117811,
       PR tree-optimization/120638, PR middle-end/120547, PR c++/120577,
       PR c++/120940, PR c++/120471, PR fortran/121060, PR libstdc++/120548,
       PR libstdc++/99832.
   * Fix broken ada timespec record with -D_TIME_BITS=64 on 32-bit big-endian
     targets (John David Anglin). Closes: #1108322.
Checksums-Sha1:
 a45dbb56efd6093503a4d87296c51cc7d01eaca4 42270 gcc-14_14.3.0-4.dsc
 8bb0371e9203e71167aca9262b246c9a4afebb61 601952 gcc-14_14.3.0-4.debian.tar.xz
 9752af2cb1eda8510dea0a13360074f4931588d9 9887 gcc-14_14.3.0-4_source.buildinfo
Checksums-Sha256:
 bc881bf5b78c44418b24b071c53025c659addd35cdc8a636a1038247e741da88 42270 gcc-14_14.3.0-4.dsc
 22596fa57e738c785b9e05c54044e864077a4219ff397840f90f8ba3e13813a1 601952 gcc-14_14.3.0-4.debian.tar.xz
 9625d907a5238dd45ea8dfe3e67d395c537423ddadfb78b42ab4e194f31819ad 9887 gcc-14_14.3.0-4_source.buildinfo
Files:
 e79cbad9eb672ca960adeddbb0edc0c5 42270 devel optional gcc-14_14.3.0-4.dsc
 6c5b7971422b7d2a66ca4abf521b8459 601952 devel optional gcc-14_14.3.0-4.debian.tar.xz
 008a73640be9c60d460c5da60b18a9fc 9887 devel optional gcc-14_14.3.0-4_source.buildinfo
-----BEGIN PGP SIGNATURE-----

iQJEBAEBCgAuFiEE1WVxuIqLuvFAv2PWvX6qYHePpvUFAmiHr38QHGRva29AZGVi
aWFuLm9yZwAKCRC9fqpgd4+m9R2dEACrOQv3mctnhS+tLOL1kPXPT8KhLvNUevyp
XysPYqGTeoPyLNcNDZ8x6vrDKb6n7UH1jUHk+yRnyxzwKZ+LUcLMiSCevPpN4nr+
NsyFJNo5MTukyqdrIAtqStfjQgZPDsEOPFmUUFgjAk6c07qIbv9wwWjqSBhv8Rwg
4b5/tf5BLvCfjZg0PweyECCGCpfbdKfnoq1MxTy9FjDAMDJvHTQeiVw7lr9vi+Kr
/u6YvhNhilANdTgbesgd1/VQhVKdAMj2mgPQ45X87sM1wnRTVKmmfpFLrbzxaHph
6F6JZ4xmoDgvkwLjAdvXdSrCWhSW3mWmEwsfxCeSDSKAVAQg4e2Dv7F4hs2lbY+t
FtW0ILHT8B/w0O5slDR8lJWkNOgGicdOr/npVpUym9iZt5trk40pLt1PaP+PwcT6
Xp6YsFPr/vltkcLo3x9lzSyT1Z4xUeWJsnABvlu/CoHQiqINkQ6pzyBDnBHm5DbF
XdkQl+sNgexsIYQpSKJAh8UNmsOxb8GHlROjVrsCAqdcK3sx+u5eW5WyTe/zl2gG
I0hqk8QtNse4BPuDvVA4tS+VPqk/NYEP3QdxE7+r+U4y6UY5GusQtqpvTYRSIHyk
XZZAXGHjxUWwHrK0yIBZP7i94Dh2mue4J9fa8kotrtPFRG5h2WYeqa57DWwar3wh
ieOd9QFgqA==
=Jh8z
-----END PGP SIGNATURE-----

#1108322#15
Date:
2025-08-04 08:37:50 UTC
From:
To:
this change has some unintended (?) effects for at least 32bit little
endian targets as well.  It changes at least the Provides in
gnat-14-arm-linux-gnueabihf in 14.3.0-4, compared to -3.

That should be fixed. As a work around, I'll apply this patch only for
32bit big-endian targets for now.

#1108322#24
Date:
2025-12-02 03:00:52 UTC
From:
To:
now updating the patch for gcc-16.  I see this is not yet forwarded?
#1108322#31
Date:
2026-09-26 17:36:03 UTC
From:
To:
Hello.

John, does the attachment fix your issue on hppa?

It is based on commit 46a84dc8cf833237aa442ddaea06feafd1961920 in the
GCC repository, but not pushed yet because it changes the hashed
Provides for libgnat.

If you are using the upstream sources, these are patches 3,4 in
attachment v20 at pr114065.

#1108322#36
Date:
2026-10-24 11:06:12 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
gcc-16, 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 1108322@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Matthias Klose <doko@debian.org> (supplier of updated gcc-16 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: Sat, 24 Oct 2026 12:39:05 +0200
Source: gcc-16
Architecture: source
Version: 16.2.0-4
Distribution: unstable
Urgency: medium
Maintainer: Debian GCC Maintainers <debian-gcc@lists.debian.org>
Changed-By: Matthias Klose <doko@debian.org>
Closes: 1108322 1115882 1136069
Changes:
 gcc-16 (16.2.0-4) unstable; urgency=medium
 .
   * Update to git 20261024 from the gcc-16 branch.
     - Fix PR ada/120106, PR target/127843 (PA), PR target/128105 (x86),
       PR target/127692 (S390), PR target/127851 (x86),
       PR tree-optimization/127357, PR tree-optimization/127916,
       PR tree-optimization/126462, PR target/127393 (AArch64),
       PR target/127393 (AArch64), PR tree-optimization/127382,
       PR target/125060 (PPC),  PR target/127553 (RISCV),
       PR tree-optimization/127687, PR middle-end/127517, PR middle-end/127492,
       PR target/127498 (x86), PR middle-end/127378, PR target/127352 (x86),
       PR middle-end/127336, PR tree-optimization/127149, PR target/127482 (AVR),
       PR middle-end/127474, PR target/127650 (x86), PR target/126096 (AArch64),
       PR tree-optimization/127579, PR target/107549 (xtensa),
       PR target/126629 (AArch64), PR tree-optimization/127571,
       PR rtl-optimization/127367, PR target/127500 (x86),
       PR target/127461 (x86), PR ada/128044, PR ada/127994, PR ada/127974,
       PR ada/127994, PR ada/127880, PR ada/127759, PR ada/126448, PR ada/126125,
       PR ada/127756, PR c/127383, PR c++/127232, PR c++/126794, PR c++/127749,
       PR c++/126680, PR c++/125536, PR c++/127493, PR c++/127276,
       PR c++/127109, PR c++/126922, PR c++/122774, PR c++/127707,
       PR c++/127672, PR c++/126654, PR c++/127643, PR fortran/110421,
       PR fortran/127683, PR fortran/127187, PR fortran/125324,
       PR preprocessor/121508, PR preprocessor/123339, PR fortran/127845,
       PR fortran/127846, PR other/116547, PR libstdc++/127757,
       PR libstdc++/115955, PR libstdc++/124370, PR libstdc++/125785,
       PR libstdc++/127666, PR libstdc++/126364, PR libstdc++/114400,
       PR libstdc++/127656, PR libstdc++/123409, PR libstdc++/126786.
 .
   [ Matthias Klose ]
   * Update libstdc++ (all archs) and libgcc (armhf, arm64) symbols files.
 .
   [ Nicolas Boulenguez ]
   * Ada: fix GNATMAKE_FOR_BUILD in ada-gnat-name.diff. Closes: #1136069.
     Build gnat with gnat-16 again.
     Refresh and apply ada-gcc-name.diff.
     Report a source diff when the alihash changes. Closes: #1115882.
     Refresh the PR ada/114065 time_t64 patches. Closes: #1108322.
   * Compute the libgnat alihash with crc32 instead of xor.
Checksums-Sha1:
 59035b7569dd966fc880f57023572e4d7a57c5f8 52568 gcc-16_16.2.0-4.dsc
 013e36f4553da1f4aa1086ba8060e262e0009836 2910576 gcc-16_16.2.0-4.debian.tar.xz
 7b23ac092b14d9b15b319a9561b8f394b016dbef 11069 gcc-16_16.2.0-4_source.buildinfo
Checksums-Sha256:
 a11ecbfc25faf255e3808ef3928008f6e3339eb8d999f43026d62636117dc63d 52568 gcc-16_16.2.0-4.dsc
 f141ada9f761935a5446117393e173b71ca110ad5f73ae834362ca26d61426c4 2910576 gcc-16_16.2.0-4.debian.tar.xz
 d2cdfccc4dd47a96b236bd51729a1925a824d0e7e489c8dde60c279e7d22c8d2 11069 gcc-16_16.2.0-4_source.buildinfo
Files:
 0b2a4400a1efd9a3e553ca538b244611 52568 devel optional gcc-16_16.2.0-4.dsc
 92f8b53638cca88aa1ffc0e18dcd466b 2910576 devel optional gcc-16_16.2.0-4.debian.tar.xz
 fb20b3f3a47a5c50758e6341a53c5d4e 11069 devel optional gcc-16_16.2.0-4_source.buildinfo
-----BEGIN PGP SIGNATURE-----

iQJEBAEBCgAuFiEE1WVxuIqLuvFAv2PWvX6qYHePpvUFAmrci5AQHGRva29AZGVi
aWFuLm9yZwAKCRC9fqpgd4+m9Zp+EADCtnaLu/PVkf6MeYD43XeZl+sU2FibyOQ/
79FSHwF1jyWxlYUNrgBlHmTCNMsBEtThYPqDv29ZRRO4PWV17CRpoyHvU1/RSifh
Jj/O9qkPXQBgs+VN7CDkCe56klJUsCNZrGYo58QPlCpIn3buhfZ63duteyjHYa53
Vkvgs6qmxAZGX71/EczAf9S3FPZ9JGVjtulFuQ4BLeI/LcxyLen9etWlJ2rSRaha
IwUMBH+LZV00gvQ7GqRt5vfoz1NP0LTFExlidxYrPHNdxgtmofTJwoVCckjZtezb
Gf7oOvr4am3XkTbOdj+osBHCx5MaB2cSYB0p56gfq6oU5U9Xj2OCV2ChUD33LoeJ
27fePwFYrApzhj3XS5bydzXYVWvUejZ8tXB06xwr55oC8Qq0Q4pgt0EzFTSVMpdG
Wz6l2tPDEY6q1wxAkWXLQkgV3FWZRLWXqx80EuaFtCo8fIb0qkRd//+mbja55F1R
qoTZzfJcBcI2Tl0NAmt9biPEOprCjb0FUpFLrBJee1M/DFUMGBg7koDYyTwZMZgl
yITxmHICgC15/jraxuiFIszsya/pqLCXTHqXIdGCkxTJ6v7jX5h2OaaLRKlk5V91
q6k8ksS5doHhofTp/mcgFqyCS9bWFDInEVZqZhhoGhaT7gT/7VzeI9JJWMKHCFPl
+TU3xgN2ww==
=BMa/
-----END PGP SIGNATURE-----