public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/114065] New: gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs
@ 2024-02-22 19:40 doko at gcc dot gnu.org
  2024-02-26 11:04 ` [Bug ada/114065] " ebotcazou at gcc dot gnu.org
                   ` (24 more replies)
  0 siblings, 25 replies; 26+ messages in thread
From: doko at gcc dot gnu.org @ 2024-02-22 19:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114065

            Bug ID: 114065
           Summary: gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64
                    fails on 32bit archs
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: doko at gcc dot gnu.org
                CC: dkm at gcc dot gnu.org
  Target Milestone: ---

trying to build with time_t64 on 32bit archs fails with:

g-socket.adb:2860:26: error: value not in range of type "time_t" defined at
g-sothco.ads:47
g-socket.adb:2860:26: error: static expression fails Constraint_Check
g-socket.adb:2862:26: error: value not in range of type "time_t" defined at
g-sothco.ads:47
g-socket.adb:2862:26: error: static expression fails Constraint_Check
make[8]: *** [../gcc-interface/Makefile:301: g-socket.o] Error 1
make[8]: Leaving directory '/<<PKGBUILDDIR>>/build/gcc/ada/rts'

this can be fixed with

--- a/gcc/ada/libgnat/s-parame.ads
+++ b/gcc/ada/libgnat/s-parame.ads
@@ -102,7 +102,7 @@
    -- Characteristics of time_t type --
    ------------------------------------

-   time_t_bits : constant := Long_Integer'Size;
+   time_t_bits : constant := Long_Long_Integer'Size;
    --  Number of bits in type time_t

    ----------------------------------------------

however that's not the correct fix. Is there any way to fix this in a better
way?

Plust, this uncovered a bootstrap error on hppa-linux See PR114062

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug ada/114065] gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs
  2024-02-22 19:40 [Bug ada/114065] New: gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs doko at gcc dot gnu.org
@ 2024-02-26 11:04 ` ebotcazou at gcc dot gnu.org
  2024-03-22  0:05 ` pinskia at gcc dot gnu.org
                   ` (23 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2024-02-26 11:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114065

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-02-26
                 CC|                            |ebotcazou at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #1 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> however that's not the correct fix. Is there any way to fix this in a better
> way?

s-parame__posix2008.ads already has the 64-bit time_t so you just need to tweak
Makefile.rtl.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug ada/114065] gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs
  2024-02-22 19:40 [Bug ada/114065] New: gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs doko at gcc dot gnu.org
  2024-02-26 11:04 ` [Bug ada/114065] " ebotcazou at gcc dot gnu.org
@ 2024-03-22  0:05 ` pinskia at gcc dot gnu.org
  2024-03-22  0:57 ` doko at gcc dot gnu.org
                   ` (22 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-22  0:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114065

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 114424 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug ada/114065] gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs
  2024-02-22 19:40 [Bug ada/114065] New: gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs doko at gcc dot gnu.org
  2024-02-26 11:04 ` [Bug ada/114065] " ebotcazou at gcc dot gnu.org
  2024-03-22  0:05 ` pinskia at gcc dot gnu.org
@ 2024-03-22  0:57 ` doko at gcc dot gnu.org
  2024-03-22  8:05 ` ebotcazou at gcc dot gnu.org
                   ` (21 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: doko at gcc dot gnu.org @ 2024-03-22  0:57 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114065

--- Comment #3 from Matthias Klose <doko at gcc dot gnu.org> ---
Created attachment 57763
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57763&action=edit
proposed patch

is that the correct approach? most likely has to be guarded with a configure
option.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug ada/114065] gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs
  2024-02-22 19:40 [Bug ada/114065] New: gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs doko at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-03-22  0:57 ` doko at gcc dot gnu.org
@ 2024-03-22  8:05 ` ebotcazou at gcc dot gnu.org
  2024-03-23 18:55 ` ebotcazou at gcc dot gnu.org
                   ` (20 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2024-03-22  8:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114065

--- Comment #4 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> is that the correct approach? most likely has to be guarded with a configure
> option.

The conditional setting is very likely superfluous, i.e. you can use the POSIX
2008 version whatever the multilib on Linux.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug ada/114065] gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs
  2024-02-22 19:40 [Bug ada/114065] New: gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs doko at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2024-03-22  8:05 ` ebotcazou at gcc dot gnu.org
@ 2024-03-23 18:55 ` ebotcazou at gcc dot gnu.org
  2024-04-03 17:46 ` nicolas at debian dot org
                   ` (19 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2024-03-23 18:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114065

--- Comment #5 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
*** Bug 114424 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug ada/114065] gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs
  2024-02-22 19:40 [Bug ada/114065] New: gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs doko at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2024-03-23 18:55 ` ebotcazou at gcc dot gnu.org
@ 2024-04-03 17:46 ` nicolas at debian dot org
  2024-04-03 17:47 ` nicolas at debian dot org
                   ` (18 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: nicolas at debian dot org @ 2024-04-03 17:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114065

Nicolas Boulenguez <nicolas at debian dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nicolas at debian dot org

--- Comment #6 from Nicolas Boulenguez <nicolas at debian dot org> ---
Created attachment 57865
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57865&action=edit
Ada: define time_t timeval timespec C types in a single place

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug ada/114065] gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs
  2024-02-22 19:40 [Bug ada/114065] New: gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs doko at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2024-04-03 17:46 ` nicolas at debian dot org
@ 2024-04-03 17:47 ` nicolas at debian dot org
  2024-04-03 17:48 ` nicolas at debian dot org
                   ` (17 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: nicolas at debian dot org @ 2024-04-03 17:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114065

--- Comment #7 from Nicolas Boulenguez <nicolas at debian dot org> ---
Hello.

The attached suggestions (based on gcc-13/13.2.0) might solve the current
issue, or at least simplify the investigation, but they are so intrusive that I
would like a quick review by experts before testing anything.  For now, I have
not even tried a build.

In principle, is there a chance that you accept such changes upstream, once/if
they are tested in Debian?

The main suggestion is of course 'Define time_t ... in a single place'. Then,
```
diff -u --color=auto libgnarl/s-linux{,__x32}.ads
diff -u --color=auto libgnat/s-parame{,__posix2008}.ads
diff -u --color=auto libgnat/s-osprim__{unix,solaris}.adb
diff -u --color=auto libgnat/s-osprim__{rtems,darwin}.adb
diff -u --color=auto libgnat/s-osprim__{rtems,x32}.adb
```
should validate the removal and the last suggestion should be trivial.

Thanks in advance.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug ada/114065] gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs
  2024-02-22 19:40 [Bug ada/114065] New: gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs doko at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2024-04-03 17:47 ` nicolas at debian dot org
@ 2024-04-03 17:48 ` nicolas at debian dot org
  2024-04-03 17:48 ` nicolas at debian dot org
                   ` (16 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: nicolas at debian dot org @ 2024-04-03 17:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114065

--- Comment #8 from Nicolas Boulenguez <nicolas at debian dot org> ---
Created attachment 57866
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57866&action=edit
Ada: drop unneeded x32 variant of System.Linux

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug ada/114065] gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs
  2024-02-22 19:40 [Bug ada/114065] New: gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs doko at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2024-04-03 17:48 ` nicolas at debian dot org
@ 2024-04-03 17:48 ` nicolas at debian dot org
  2024-04-03 17:49 ` nicolas at debian dot org
                   ` (15 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: nicolas at debian dot org @ 2024-04-03 17:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114065

--- Comment #9 from Nicolas Boulenguez <nicolas at debian dot org> ---
Created attachment 57867
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57867&action=edit
Ada: drop unneeded posix2008 variant of System.Parameters

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug ada/114065] gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs
  2024-02-22 19:40 [Bug ada/114065] New: gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs doko at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2024-04-03 17:48 ` nicolas at debian dot org
@ 2024-04-03 17:49 ` nicolas at debian dot org
  2024-04-03 17:49 ` nicolas at debian dot org
                   ` (14 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: nicolas at debian dot org @ 2024-04-03 17:49 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114065

--- Comment #10 from Nicolas Boulenguez <nicolas at debian dot org> ---
Created attachment 57868
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57868&action=edit
Ada: drop unneeded darwin, solaris, x32 variants of System.OS_Primitives

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug ada/114065] gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs
  2024-02-22 19:40 [Bug ada/114065] New: gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs doko at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2024-04-03 17:49 ` nicolas at debian dot org
@ 2024-04-03 17:49 ` nicolas at debian dot org
  2024-04-04 10:12 ` charlet at gcc dot gnu.org
                   ` (13 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: nicolas at debian dot org @ 2024-04-03 17:49 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114065

--- Comment #11 from Nicolas Boulenguez <nicolas at debian dot org> ---
Created attachment 57869
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57869&action=edit
Ada: import nanosleep from System.OS_Primitives.Timed_Delay

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug ada/114065] gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs
  2024-02-22 19:40 [Bug ada/114065] New: gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs doko at gcc dot gnu.org
                   ` (10 preceding siblings ...)
  2024-04-03 17:49 ` nicolas at debian dot org
@ 2024-04-04 10:12 ` charlet at gcc dot gnu.org
  2024-04-04 14:20 ` nicolas at debian dot org
                   ` (12 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: charlet at gcc dot gnu.org @ 2024-04-04 10:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114065

Arnaud Charlet <charlet at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |charlet at gcc dot gnu.org

--- Comment #12 from Arnaud Charlet <charlet at gcc dot gnu.org> ---
Yes, on paper this looks like a very nice cleanup, thank you!

The tricky part is to carefully review the conversion code, as well as the
change in GNAT.Sockets* (perhaps consider separating the changes in
GNAT.Socket* in another patch on top of the first one, that will ease the
review if possible).

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug ada/114065] gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs
  2024-02-22 19:40 [Bug ada/114065] New: gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs doko at gcc dot gnu.org
                   ` (11 preceding siblings ...)
  2024-04-04 10:12 ` charlet at gcc dot gnu.org
@ 2024-04-04 14:20 ` nicolas at debian dot org
  2024-04-04 14:45 ` nicolas at debian dot org
                   ` (11 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: nicolas at debian dot org @ 2024-04-04 14:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114065

Nicolas Boulenguez <nicolas at debian dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #57865|0                           |1
        is obsolete|                            |

--- Comment #13 from Nicolas Boulenguez <nicolas at debian dot org> ---
Created attachment 57876
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57876&action=edit
Ada: define time_t timeval timespec C types in a single place

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug ada/114065] gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs
  2024-02-22 19:40 [Bug ada/114065] New: gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs doko at gcc dot gnu.org
                   ` (12 preceding siblings ...)
  2024-04-04 14:20 ` nicolas at debian dot org
@ 2024-04-04 14:45 ` nicolas at debian dot org
  2024-04-05 16:30 ` nicolas at debian dot org
                   ` (10 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: nicolas at debian dot org @ 2024-04-04 14:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114065

--- Comment #14 from Nicolas Boulenguez <nicolas at debian dot org> ---
The new version does not change much, but I am only posting it in order to
prevent duplicated work.
I will try to split the timespec changes and the timeval+Sockets changes, then
attempt a build.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug ada/114065] gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs
  2024-02-22 19:40 [Bug ada/114065] New: gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs doko at gcc dot gnu.org
                   ` (13 preceding siblings ...)
  2024-04-04 14:45 ` nicolas at debian dot org
@ 2024-04-05 16:30 ` nicolas at debian dot org
  2024-04-05 16:36 ` nicolas at debian dot org
                   ` (9 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: nicolas at debian dot org @ 2024-04-05 16:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114065

Nicolas Boulenguez <nicolas at debian dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #57866|0                           |1
        is obsolete|                            |
  Attachment #57867|0                           |1
        is obsolete|                            |
  Attachment #57868|0                           |1
        is obsolete|                            |
  Attachment #57869|0                           |1
        is obsolete|                            |
  Attachment #57876|0                           |1
        is obsolete|                            |

--- Comment #15 from Nicolas Boulenguez <nicolas at debian dot org> ---
Created attachment 57890
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57890&action=edit
eight commits isolating the definition of C time types

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug ada/114065] gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs
  2024-02-22 19:40 [Bug ada/114065] New: gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs doko at gcc dot gnu.org
                   ` (14 preceding siblings ...)
  2024-04-05 16:30 ` nicolas at debian dot org
@ 2024-04-05 16:36 ` nicolas at debian dot org
  2024-04-06 11:37 ` ebotcazou at gcc dot gnu.org
                   ` (8 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: nicolas at debian dot org @ 2024-04-05 16:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114065

--- Comment #16 from Nicolas Boulenguez <nicolas at debian dot org> ---
This 3rd attempt does the requested split.
It fixes all build errors on Debian/amd64.
The new Ada.Calendar.Clock returns sensible results.
In other words, it seems ready for review.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug ada/114065] gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs
  2024-02-22 19:40 [Bug ada/114065] New: gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs doko at gcc dot gnu.org
                   ` (15 preceding siblings ...)
  2024-04-05 16:36 ` nicolas at debian dot org
@ 2024-04-06 11:37 ` ebotcazou at gcc dot gnu.org
  2024-04-08  9:19 ` nicolas at debian dot org
                   ` (7 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2024-04-06 11:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114065

--- Comment #17 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Nice work indeed, in an area that clearly needed it, thanks!

Something potentially problematic though:

+package body System.CRTL is
+
+   --  In GNAT, Duration'Size = 64.
+   function Duration_To_int64 is new Ada.Unchecked_Conversion
+     (Duration, int64);

That's not universal, see Targparm:

   ---------------------
   -- Duration Format --
   ---------------------

   --  By default, type Duration is a 64-bit fixed-point type with a delta
   --  and small of 10**(-9) (i.e. it is a count in nanoseconds). This flag
   --  allows that standard format to be modified.

   Duration_32_Bits_On_Target : Boolean := False;
   --  If True, then Duration is represented in 32 bits and the delta and
   --  small values are set to 20.0*(10**(-3)) (i.e. it is a count in units
   --  of 20 milliseconds).

although Duration_32_Bit is indeed False in all the system-*.ads files.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug ada/114065] gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs
  2024-02-22 19:40 [Bug ada/114065] New: gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs doko at gcc dot gnu.org
                   ` (16 preceding siblings ...)
  2024-04-06 11:37 ` ebotcazou at gcc dot gnu.org
@ 2024-04-08  9:19 ` nicolas at debian dot org
  2024-04-11 10:53 ` nicolas at debian dot org
                   ` (6 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: nicolas at debian dot org @ 2024-04-08  9:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114065

--- Comment #18 from Nicolas Boulenguez <nicolas at debian dot org> ---
Created attachment 57897
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57897&action=edit
rewrite commit 3/8 so that Duration'Size may be 32

Would version 4 of commit 3/8 be OK? It only modifies s-crtl.ad[bs].

A bit out of the subject, but if GNAT supports Duration'Size = 32,
a-reatim.adb
s-ransee.adb
a-calend.adb
probably deserve comments about the way the conversion deals with the size
difference and sign bit.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug ada/114065] gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs
  2024-02-22 19:40 [Bug ada/114065] New: gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs doko at gcc dot gnu.org
                   ` (17 preceding siblings ...)
  2024-04-08  9:19 ` nicolas at debian dot org
@ 2024-04-11 10:53 ` nicolas at debian dot org
  2024-04-24 10:26 ` doko at gcc dot gnu.org
                   ` (5 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: nicolas at debian dot org @ 2024-04-11 10:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114065

Nicolas Boulenguez <nicolas at debian dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #57890|0                           |1
        is obsolete|                            |
  Attachment #57897|0                           |1
        is obsolete|                            |

--- Comment #19 from Nicolas Boulenguez <nicolas at debian dot org> ---
Created attachment 57926
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57926&action=edit
eight commits isolating the definition of C time types

This version 5 fixes typos in commit 3 that were breaking the build with 1-3
applied only on x86_64-linux-gnu.
Commit 8 is adapted so that the overall effect of 1-8 is unchanged.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug ada/114065] gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs
  2024-02-22 19:40 [Bug ada/114065] New: gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs doko at gcc dot gnu.org
                   ` (18 preceding siblings ...)
  2024-04-11 10:53 ` nicolas at debian dot org
@ 2024-04-24 10:26 ` doko at gcc dot gnu.org
  2024-04-24 10:33 ` doko at gcc dot gnu.org
                   ` (4 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: doko at gcc dot gnu.org @ 2024-04-24 10:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114065

--- Comment #20 from Matthias Klose <doko at gcc dot gnu.org> ---
Nicolas, the patch series fails to apply on the trunk.  Please could you update
it, then post it on gcc-patches to get a proper review?

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug ada/114065] gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs
  2024-02-22 19:40 [Bug ada/114065] New: gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs doko at gcc dot gnu.org
                   ` (19 preceding siblings ...)
  2024-04-24 10:26 ` doko at gcc dot gnu.org
@ 2024-04-24 10:33 ` doko at gcc dot gnu.org
  2024-04-24 17:19 ` nicolas at debian dot org
                   ` (3 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: doko at gcc dot gnu.org @ 2024-04-24 10:33 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114065

--- Comment #21 from Matthias Klose <doko at gcc dot gnu.org> ---
trying to update your patches, the build then fails with:

../../xgcc -B../../ -c -g -O2     -W -Wall  -gnatpg 
-gnata -gnatn -I- -nostdinc
-I/home/packages/gcc/14/gcc-14-14-20240424/build/gcc/ada/rts -I.
-I/home/packages/
gcc/14/gcc-14-14-20240424/src/gcc/ada
/home/packages/gcc/14/gcc-14-14-20240424/src/gcc/ada/osint.adb -o osint.
o
osint.adb:3281:17: error: "time_t" is undefined (more references follow)
osint.adb:3295:28: error: invalid operand types for operator "*"
osint.adb:3295:28: error: right operand has type universal integer
make[5]: *** [../gcc-interface/Makefile:306: osint.o] Error 1

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug ada/114065] gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs
  2024-02-22 19:40 [Bug ada/114065] New: gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs doko at gcc dot gnu.org
                   ` (20 preceding siblings ...)
  2024-04-24 10:33 ` doko at gcc dot gnu.org
@ 2024-04-24 17:19 ` nicolas at debian dot org
  2024-04-24 22:47 ` nicolas at debian dot org
                   ` (2 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: nicolas at debian dot org @ 2024-04-24 17:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114065

Nicolas Boulenguez <nicolas at debian dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #57926|0                           |1
        is obsolete|                            |

--- Comment #22 from Nicolas Boulenguez <nicolas at debian dot org> ---
Created attachment 58028
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58028&action=edit
merge all definitions and conversions for timeval and timespec

Hello.

Moving the definitions into System.CRTL was a bad idea because they are needed
before the target libgnat is built.
The attached version 6 creates a new System.C_Time unit.

It also adds a script testing the C_Time functions against handwritten results
on 32 combinations of type sizes for Duration, time_t and suseconds_t.

With the first four patches applied, gcc-13.2.0 (with Debian patches) builds on
x86_64-linux-gnu and arm-linux-gnueabihf.

The following program then gives the correct date on x86_64-linux-gnu but
random dates or Time_Error on arm-linux-gnueabihf.
So the original issue remains.
--
with Ada.Calendar, Ada.Text_IO;
procedure Demo is
   Y : Ada.Calendar.Year_Number;
   M : Ada.Calendar.Month_Number;
   D : Ada.Calendar.Day_Number;
   S : Duration;
   H, Min : Integer;
begin
   Ada.Calendar.Split (Ada.Calendar.Clock, Y, M, D, S);
   H := Integer ((S / 3_600) - 0.5);
   S := S - 3600 * Duration (H);
   Min := Integer ((S / 60) - 0.5);
   S := S - 60 * Duration (Min);
   Ada.Text_IO.Put_Line (Y'Img & M'Img & D'Img & H'Img & Min'Img & S'Img);
end Demo;
--

The commits are rebased on the trunk, with only trivial changes but untested.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug ada/114065] gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs
  2024-02-22 19:40 [Bug ada/114065] New: gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs doko at gcc dot gnu.org
                   ` (21 preceding siblings ...)
  2024-04-24 17:19 ` nicolas at debian dot org
@ 2024-04-24 22:47 ` nicolas at debian dot org
  2024-04-28 20:32 ` nicolas at debian dot org
  2024-05-02 15:34 ` nicolas at debian dot org
  24 siblings, 0 replies; 26+ messages in thread
From: nicolas at debian dot org @ 2024-04-24 22:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114065

--- Comment #23 from Nicolas Boulenguez <nicolas at debian dot org> ---
Always with gcc-13.2.0+Debian patches on arm-linux-gnueabihf,

if s-osprim__posix.adb imports and calls

int
__gnat_gettimeofday(struct timeval *restrict tv,
                    struct timezone *restrict tz)
{
  return gettimeofday(tv, tz);
}

defined in cal.c instead of directly importing and calling the C gettimeofday
as it does for now, the returned date is correct.

This suggests that there is a distinct issue and provides a workaround for it.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug ada/114065] gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs
  2024-02-22 19:40 [Bug ada/114065] New: gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs doko at gcc dot gnu.org
                   ` (22 preceding siblings ...)
  2024-04-24 22:47 ` nicolas at debian dot org
@ 2024-04-28 20:32 ` nicolas at debian dot org
  2024-05-02 15:34 ` nicolas at debian dot org
  24 siblings, 0 replies; 26+ messages in thread
From: nicolas at debian dot org @ 2024-04-28 20:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114065

Nicolas Boulenguez <nicolas at debian dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #58028|0                           |1
        is obsolete|                            |

--- Comment #24 from Nicolas Boulenguez <nicolas at debian dot org> ---
Created attachment 58060
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58060&action=edit
timeval timespec: merge all definitions, select 32 or 64 bits variants on glibc

Hello.

The second issue is caused by glibc implementing (on architectures where time_t
was 32 bits by default)
  gettimeofday
  __gettimeofday64
and #defining gettimeofday __gettimeofday64 if __USE_TIME_BITS64.
Ada, ignoring this, was still importing the 32 bits version.

The attached archive patches all such issues as far as I know.
The patch has been tested on x86_64-linux-gnu (time_t64 is the default) and
arm-linux-gnueabihf (time_t64 is affected by __USE_TIME_BITS64).

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug ada/114065] gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs
  2024-02-22 19:40 [Bug ada/114065] New: gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs doko at gcc dot gnu.org
                   ` (23 preceding siblings ...)
  2024-04-28 20:32 ` nicolas at debian dot org
@ 2024-05-02 15:34 ` nicolas at debian dot org
  24 siblings, 0 replies; 26+ messages in thread
From: nicolas at debian dot org @ 2024-05-02 15:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114065

--- Comment #25 from Nicolas Boulenguez <nicolas at debian dot org> ---
The suggested changes for libgnat slightly affect gprbuild.
https://salsa.debian.org/debian/gprbuild/-/blob/debian/master/debian/patches/adapt-to-private-time-t.diff
https://salsa.debian.org/debian/gprbuild/-/blob/debian/master/debian/patches/adapt-to-private-timeval.diff

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2024-05-02 15:34 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-22 19:40 [Bug ada/114065] New: gnat build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 fails on 32bit archs doko at gcc dot gnu.org
2024-02-26 11:04 ` [Bug ada/114065] " ebotcazou at gcc dot gnu.org
2024-03-22  0:05 ` pinskia at gcc dot gnu.org
2024-03-22  0:57 ` doko at gcc dot gnu.org
2024-03-22  8:05 ` ebotcazou at gcc dot gnu.org
2024-03-23 18:55 ` ebotcazou at gcc dot gnu.org
2024-04-03 17:46 ` nicolas at debian dot org
2024-04-03 17:47 ` nicolas at debian dot org
2024-04-03 17:48 ` nicolas at debian dot org
2024-04-03 17:48 ` nicolas at debian dot org
2024-04-03 17:49 ` nicolas at debian dot org
2024-04-03 17:49 ` nicolas at debian dot org
2024-04-04 10:12 ` charlet at gcc dot gnu.org
2024-04-04 14:20 ` nicolas at debian dot org
2024-04-04 14:45 ` nicolas at debian dot org
2024-04-05 16:30 ` nicolas at debian dot org
2024-04-05 16:36 ` nicolas at debian dot org
2024-04-06 11:37 ` ebotcazou at gcc dot gnu.org
2024-04-08  9:19 ` nicolas at debian dot org
2024-04-11 10:53 ` nicolas at debian dot org
2024-04-24 10:26 ` doko at gcc dot gnu.org
2024-04-24 10:33 ` doko at gcc dot gnu.org
2024-04-24 17:19 ` nicolas at debian dot org
2024-04-24 22:47 ` nicolas at debian dot org
2024-04-28 20:32 ` nicolas at debian dot org
2024-05-02 15:34 ` nicolas at debian dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).