From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2E8883858D1E; Tue, 19 Mar 2024 11:24:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2E8883858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1710847455; bh=yXkWoXrRPQZkkl4uz2HyWcbbmSMZc1Z9oawBUTDoDdw=; h=From:To:Subject:Date:From; b=Oc154/Xk/CMzyRuL2HCMuNa1Cp0bLTQ4Bx6cvW5Cu/FWUK/fTJXpz/DMsjhE1cAt7 l+MrS2fT7gJFkbbuDxUJGaBLvQr8n3VSiUC0q3NNoTH3GhTAubE/obct47sApMYJds jCfK36XRPgnIucn0RW/xY8iyElr+LBsAPMrH36D0= From: "simon.chopin at canonical dot com" To: glibc-bugs@sourceware.org Subject: [Bug time/31510] New: Wrong type for timeval.tv_usec on 32-bit archs with _TIME_BITS=64 Date: Tue, 19 Mar 2024 11:24:14 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: time X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: simon.chopin at canonical dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot 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 target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31510 Bug ID: 31510 Summary: Wrong type for timeval.tv_usec on 32-bit archs with _TIME_BITS=3D64 Product: glibc Version: unspecified Status: UNCONFIRMED Severity: normal Priority: P2 Component: time Assignee: unassigned at sourceware dot org Reporter: simon.chopin at canonical dot com Target Milestone: --- POSIX documents struct timeval as follows: struct timeval { time_t tv_sec; /* seconds */ suseconds_t tv_usec; /* microseconds */ }; Since bdc4782744df73a8c0559985c54b5b6b9c7a4a74 ("y2038: Add __USE_TIME_BITS= 64 support for struct timeval") tv_usec can have __suseconds64_t when using 64= -bit time, however suseconds_t is unconditionally typedefed to __suseconds_t. That leads to the following: ubuntu@mantic-armhf:~$ cat test.c #include #include #include int main(void) { struct timeval tv; printf("tv_usec: %d, suseconds_t: %d\n", sizeof(tv.tv_usec), sizeof(suseconds_t)); assert(sizeof(tv.tv_usec) =3D=3D sizeof(suseconds_t)); return 0; } ubuntu@mantic-armhf:~$ gcc test.c && ./a.out tv_usec: 4, suseconds_t: 4 ubuntu@mantic-armhf:~$ gcc -D_TIME_BITS=3D64 -D_FILE_OFFSET_BITS=3D64 test.= c && ./a.out tv_usec: 8, suseconds_t: 4 a.out: test.c:9: main: Assertion `sizeof(tv.tv_usec) =3D=3D sizeof(susecond= s_t)' failed. Aborted (core dumped) We noticed this when running the conformance tests on Ubuntu Noble, where w= e've set _TIME_BITS=3D64 in the default GCC flags as part of the ongoing t64 transition. --=20 You are receiving this mail because: You are on the CC list for the bug.=