[PATCH 1/2] Merge mktime, timegm from upstream Gnulib
Florian Weimer
fweimer@redhat.com
Thu Oct 18 21:25:00 GMT 2018
* Florian Weimer:
> * 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 }
It happens for the /usr/share/zoneinfo/America/Sao_Paulo file from
tzdata-2018e-1.fc27. So the test case is not properly isolated, either.
Thanks,
Florian
More information about the Libc-alpha
mailing list