public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/114424] New: gnat: Ada.Calendar.Clock crashes on 32bit architectures with 64bit time_t
@ 2024-03-22 0:01 doko at gcc dot gnu.org
2024-03-22 0:05 ` [Bug ada/114424] " pinskia at gcc dot gnu.org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: doko at gcc dot gnu.org @ 2024-03-22 0:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114424
Bug ID: 114424
Summary: gnat: Ada.Calendar.Clock crashes on 32bit
architectures with 64bit time_t
Product: gcc
Version: 13.2.1
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: ---
[forwarded from https://bugs.debian.org/1067453]
Ada packages randomly FTBFS on 32 bit architectures with
gprbuild: raised CONSTRAINT_ERROR : a-calend.adb:371 overflow check failed
The problem originates in the gcc-13 switch to time_t64.
gcc/ada/libgnat/s-os_prim__posix.adb is affected by two apparently
distinct issues.
* s-os_prim.adb allocates 3Long_Integer=3void*=3*32 bits for the
timeval C struct, while 2*64bits = 2Long_Long_Integer are now needed.
This issue affects other files, but is easy to find and fix.
* The switch breaks the call from Ada to the C gettimeofday function.
Can anyone explain this, and ideally provide a real fix instead of
the ugly work-around below?
cat > mycal.c <<EOF
#include <sys/time.h>
int mygettimeofday(struct timeval *restrict tv,
struct timezone *restrict tz) {
return gettimeofday(tv, tz);
}
EOF
cat > foo.adb <<EOF
with Ada.Text_IO, System.OS_Primitives;
procedure Foo is
-- On armhf, array(1..3) of Long_Integer gives random usec values.
type timeval is array (1 .. 2) of Long_Long_Integer;
procedure timeval_to_duration
(T : not null access timeval;
sec : not null access Long_Long_Integer;
usec : not null access Long_Integer);
pragma Import (C, timeval_to_duration, "__gnat_timeval_to_duration");
sec : aliased Long_Long_Integer;
usec : aliased Long_Integer;
TV : aliased timeval;
function gettimeofday (Tv : access timeval;
Tz : System.Address := System.Null_Address) return Integer;
-- On armhf, a direct import of gettimeofday leads to random Tv values.
pragma Import (C, gettimeofday, "mygettimeofday");
Result : constant Integer := gettimeofday (TV'Access, System.Null_Address);
SOP : constant Duration := System.OS_Primitives.Clock;
begin
timeval_to_duration (TV'Access, sec'Access, usec'Access);
Ada.Text_IO.Put_Line ("local :" & Sec'Img & "." & Usec'Img);
Ada.Text_IO.Put_Line ("System.OS_Primitives:" & SOP'Img);
end Foo;
EOF
gcc -c mycal.c -o mycal.o
gnatmake -gnat2022 foo -largs mycal.o
echo -n 'Machine : '; uname -m
date '+Expected : %s'
./foo
Machine : x86_64 (amd64 x86_64-linux-gnu)
Expected : 1711035183
local : 1711035183. 324545
System.OS_Primitives: 1711035183.324549000
Machine : armv7l (armhf arm-gnu-eabi)
Expected : 1711035189
local : 1711035189. 551691
System.OS_Primitives: 1113580361.675821568
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug ada/114424] gnat: Ada.Calendar.Clock crashes on 32bit architectures with 64bit time_t
2024-03-22 0:01 [Bug ada/114424] New: gnat: Ada.Calendar.Clock crashes on 32bit architectures with 64bit time_t doko at gcc dot gnu.org
@ 2024-03-22 0:05 ` pinskia at gcc dot gnu.org
2024-03-22 0:45 ` doko at gcc dot gnu.org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ 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=114424
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |DUPLICATE
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Basically a dup of bug 114065.
*** This bug has been marked as a duplicate of bug 114065 ***
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug ada/114424] gnat: Ada.Calendar.Clock crashes on 32bit architectures with 64bit time_t
2024-03-22 0:01 [Bug ada/114424] New: gnat: Ada.Calendar.Clock crashes on 32bit architectures with 64bit time_t doko at gcc dot gnu.org
2024-03-22 0:05 ` [Bug ada/114424] " pinskia at gcc dot gnu.org
@ 2024-03-22 0:45 ` doko at gcc dot gnu.org
2024-03-23 18:55 ` ebotcazou at gcc dot gnu.org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: doko at gcc dot gnu.org @ 2024-03-22 0:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114424
Matthias Klose <doko at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|DUPLICATE |---
--- Comment #2 from Matthias Klose <doko at gcc dot gnu.org> ---
I don't see a duplicate here.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug ada/114424] gnat: Ada.Calendar.Clock crashes on 32bit architectures with 64bit time_t
2024-03-22 0:01 [Bug ada/114424] New: gnat: Ada.Calendar.Clock crashes on 32bit architectures with 64bit time_t doko at gcc dot gnu.org
2024-03-22 0:05 ` [Bug ada/114424] " pinskia at gcc dot gnu.org
2024-03-22 0:45 ` doko at gcc dot gnu.org
@ 2024-03-23 18:55 ` ebotcazou at gcc dot gnu.org
2024-03-23 23:09 ` doko at gcc dot gnu.org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ 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=114424
Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |DUPLICATE
CC| |ebotcazou at gcc dot gnu.org
--- Comment #3 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Why don"t you use s-osprim__posix2008.adb if you use s-parame__posix2008.ads?
*** This bug has been marked as a duplicate of bug 114065 ***
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug ada/114424] gnat: Ada.Calendar.Clock crashes on 32bit architectures with 64bit time_t
2024-03-22 0:01 [Bug ada/114424] New: gnat: Ada.Calendar.Clock crashes on 32bit architectures with 64bit time_t doko at gcc dot gnu.org
` (2 preceding siblings ...)
2024-03-23 18:55 ` ebotcazou at gcc dot gnu.org
@ 2024-03-23 23:09 ` doko at gcc dot gnu.org
2024-03-24 8:31 ` ebotcazou at gcc dot gnu.org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: doko at gcc dot gnu.org @ 2024-03-23 23:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114424
--- Comment #4 from Matthias Klose <doko at gcc dot gnu.org> ---
are there any other files which should be used?
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug ada/114424] gnat: Ada.Calendar.Clock crashes on 32bit architectures with 64bit time_t
2024-03-22 0:01 [Bug ada/114424] New: gnat: Ada.Calendar.Clock crashes on 32bit architectures with 64bit time_t doko at gcc dot gnu.org
` (3 preceding siblings ...)
2024-03-23 23:09 ` doko at gcc dot gnu.org
@ 2024-03-24 8:31 ` ebotcazou at gcc dot gnu.org
2024-03-24 18:44 ` doko at gcc dot gnu.org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2024-03-24 8:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114424
--- Comment #5 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Any file whose name contain "posix2008" should be used in lieu of the simple
"posix" variant, but that apparently makes only two of them.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug ada/114424] gnat: Ada.Calendar.Clock crashes on 32bit architectures with 64bit time_t
2024-03-22 0:01 [Bug ada/114424] New: gnat: Ada.Calendar.Clock crashes on 32bit architectures with 64bit time_t doko at gcc dot gnu.org
` (4 preceding siblings ...)
2024-03-24 8:31 ` ebotcazou at gcc dot gnu.org
@ 2024-03-24 18:44 ` doko at gcc dot gnu.org
2024-03-24 18:59 ` doko at gcc dot gnu.org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: doko at gcc dot gnu.org @ 2024-03-24 18:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114424
--- Comment #6 from Matthias Klose <doko at gcc dot gnu.org> ---
still seen, when both posix2008 files are used.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug ada/114424] gnat: Ada.Calendar.Clock crashes on 32bit architectures with 64bit time_t
2024-03-22 0:01 [Bug ada/114424] New: gnat: Ada.Calendar.Clock crashes on 32bit architectures with 64bit time_t doko at gcc dot gnu.org
` (5 preceding siblings ...)
2024-03-24 18:44 ` doko at gcc dot gnu.org
@ 2024-03-24 18:59 ` doko at gcc dot gnu.org
2024-03-24 19:42 ` ebotcazou at gcc dot gnu.org
2024-03-25 12:06 ` doko at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: doko at gcc dot gnu.org @ 2024-03-24 18:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114424
--- Comment #7 from Matthias Klose <doko at gcc dot gnu.org> ---
something did change with Nicolas example:
date '+Expected : %s'; ./foo
Expected : 1711306699
local : 1711306700. 1362
System.OS_Primitives:-6017917000.119493888
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug ada/114424] gnat: Ada.Calendar.Clock crashes on 32bit architectures with 64bit time_t
2024-03-22 0:01 [Bug ada/114424] New: gnat: Ada.Calendar.Clock crashes on 32bit architectures with 64bit time_t doko at gcc dot gnu.org
` (6 preceding siblings ...)
2024-03-24 18:59 ` doko at gcc dot gnu.org
@ 2024-03-24 19:42 ` ebotcazou at gcc dot gnu.org
2024-03-25 12:06 ` doko at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2024-03-24 19:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114424
--- Comment #8 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
But s-osprim__posix2008.adb dies not use gettimeofday, does it ?
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug ada/114424] gnat: Ada.Calendar.Clock crashes on 32bit architectures with 64bit time_t
2024-03-22 0:01 [Bug ada/114424] New: gnat: Ada.Calendar.Clock crashes on 32bit architectures with 64bit time_t doko at gcc dot gnu.org
` (7 preceding siblings ...)
2024-03-24 19:42 ` ebotcazou at gcc dot gnu.org
@ 2024-03-25 12:06 ` doko at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: doko at gcc dot gnu.org @ 2024-03-25 12:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114424
--- Comment #9 from Matthias Klose <doko at gcc dot gnu.org> ---
not sure if that's the right forum here, however:
- in both Debian and Ubuntu, we're currently doing
the time_t 64bit transition, for gnat that is
moving from packages built with gnat-12 (32bit time_t)
to packages built with gnat-13 (64bit time_t),
on at least armhf (arm-linux-gnueabihf).
- packages succeeding to build are adasockets,
libxmlada, libgmpada, gprbuild.
- next packages failing to build are: ahven, adacgi with that error
gprbuild: raised CONSTRAINT_ERROR : a-calend.adb:371 overflow check failed
- libflorist fails with
posix-c.ads:876:07: error: size for "suseconds_t" too small, minimum allowed
is 64
posix-c.ads:876:07: error: size for "suseconds_t" too small, minimum allowed is
64
posix-c.ads:876:07: error: size for "suseconds_t" too small, minimum allowed is
64
posix-c.ads:876:07: error: size for "suseconds_t" too small, minimum allowed is
64
compilation of posix_signals.ads failed
compilation of posix-timers.adb failed
compilation of posix_process_primitives.ads failed
compilation of posix-timers-extensions.adb failed
which is https://sourceware.org/bugzilla/show_bug.cgi?id=31510
- unrelated, the libtemplates-parser build is timing out
for complete build logs see (enabling "good")
https://ubuntu-archive-team.ubuntu.com/transitions/html/gnat-13.html
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2024-03-25 12:06 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-22 0:01 [Bug ada/114424] New: gnat: Ada.Calendar.Clock crashes on 32bit architectures with 64bit time_t doko at gcc dot gnu.org
2024-03-22 0:05 ` [Bug ada/114424] " pinskia at gcc dot gnu.org
2024-03-22 0:45 ` doko at gcc dot gnu.org
2024-03-23 18:55 ` ebotcazou at gcc dot gnu.org
2024-03-23 23:09 ` doko at gcc dot gnu.org
2024-03-24 8:31 ` ebotcazou at gcc dot gnu.org
2024-03-24 18:44 ` doko at gcc dot gnu.org
2024-03-24 18:59 ` doko at gcc dot gnu.org
2024-03-24 19:42 ` ebotcazou at gcc dot gnu.org
2024-03-25 12:06 ` doko at gcc dot gnu.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).