This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 1/2] Merge mktime, timegm from upstream Gnulib
- From: Florian Weimer <fweimer at redhat dot com>
- To: Paul Eggert <eggert at cs dot ucla dot edu>
- Cc: libc-alpha at sourceware dot org
- Date: Thu, 18 Oct 2018 22:01:28 +0200
- Subject: Re: [PATCH 1/2] Merge mktime, timegm from upstream Gnulib
- References: <20180909160625.15214-1-eggert@cs.ucla.edu>
* Paul Eggert:
> [BZ #23603][BZ #16346]
> This fixes some obscure problems with integer overflow.
This patch breaks time/tst-mktime2 on armv7l-unknown-linux-gnueabihf,
with GCC 7.3:
tst-mktime2.c:70: numeric comparison failure
left: -1 (0xffffffff); from: mktime (lt)
right: 2147483647 (0x7fffffff); from: now
tst-mktime2.c:70: numeric comparison failure
left: -1 (0xffffffff); from: mktime (lt)
right: -2147483648 (0x80000000); from: now
tst-mktime2.c:70: numeric comparison failure
left: -1 (0xffffffff); from: mktime (lt)
right: 2147483646 (0x7ffffffe); from: now
tst-mktime2.c:70: numeric comparison failure
left: -1 (0xffffffff); from: mktime (lt)
right: -2147483647 (0x80000001); from: now
error: 4 test failures
This is after patching the test like this:
65 static void
66 mktime_test1 (time_t now)
67 {
68 struct tm *lt = localtime (&now);
69 TEST_VERIFY_EXIT (lt != NULL);
70 TEST_COMPARE (mktime (lt), now);
71 }
(I will submit the test changes separately.)
Is this the expected new behavior on 32-bit architectures?
Thanks,
Florian