From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 985233858D38; Fri, 22 Mar 2024 00:01:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 985233858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1711065678; bh=mxTE/euphpw3SRLD47fGXhCZFEmTmzFmGatEt+DN6Hs=; h=From:To:Subject:Date:From; b=grViTCFA3/s8qnrDda9spGJUAPas6dGq7iN9l7SOTshnTVBgH/SXxX7ZEqF5V1v3L RzfQYQPGyGrATVkbm1rIpqCImfz5eDmJrqdOtcJS/gV+WaygYvfKnajk/W7tmO6HKy N+DxbfuJXD8yiVaG2czHE9i7+mL95OOSXQnk8tF0= From: "doko at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug ada/114424] New: gnat: Ada.Calendar.Clock crashes on 32bit architectures with 64bit time_t Date: Fri, 22 Mar 2024 00:01:16 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: ada X-Bugzilla-Version: 13.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: doko at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D114424 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=3D3void*=3D3*32 bits for the timeval C struct, while 2*64bits =3D 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 < int mygettimeofday(struct timeval *restrict tv, struct timezone *restrict tz) { return gettimeofday(tv, tz); } EOF cat > foo.adb <