summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2012-06-21 02:13:59 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2012-06-21 02:15:07 -0700
commitadff17f337187985ea8c62b961fde5c9544911aa (patch)
tree1deb2e49c6c0b43716f9264fc2911c1d1ae849f0
parentbdb21d38b29f55d7266691007857697ecb2291b5 (diff)
downloadgnulib-adff17f337187985ea8c62b961fde5c9544911aa.tar.gz
posixtm-tests: port to buggy compiler
Problem reported by Simon Josefsson in <http://lists.gnu.org/archive/html/bug-gnulib/2012-06/msg00246.html>. * modules/posixtm-tests (Depends-on): Add stdint. * tests/test-posixtm.c (struct posixtm_test.t_expected): Now of type int_least64_t, not int64_t, both because that's what INT64_C returns and because int_least64_t works even on 72-bit hosts. (T): Use INT64_C on constants outside the traditional int range, to work around compiler bug noted by Simon.
-rw-r--r--ChangeLog11
-rw-r--r--modules/posixtm-tests1
-rw-r--r--tests/test-posixtm.c28
3 files changed, 30 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 1661a623aa..b3110ba61c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2012-06-21 Paul Eggert <eggert@cs.ucla.edu>
+ posixtm-tests: port to buggy compiler
+ Problem reported by Simon Josefsson in
+ <http://lists.gnu.org/archive/html/bug-gnulib/2012-06/msg00246.html>.
+ * modules/posixtm-tests (Depends-on): Add stdint.
+ * tests/test-posixtm.c (struct posixtm_test.t_expected):
+ Now of type int_least64_t, not int64_t, both because that's
+ what INT64_C returns and because int_least64_t works even
+ on 72-bit hosts.
+ (T): Use INT64_C on constants outside the traditional int range,
+ to work around compiler bug noted by Simon.
+
mktime: fix integer overflow in 'configure'-time test
* m4/mktime.m4 (gl_FUNC_MKTIME): Do not rely on undefined behavior
after integer overflow. Problem reported by Rich Felker in
diff --git a/modules/posixtm-tests b/modules/posixtm-tests
index 216d602465..7f5ada5593 100644
--- a/modules/posixtm-tests
+++ b/modules/posixtm-tests
@@ -5,6 +5,7 @@ tests/macros.h
Depends-on:
intprops
setenv
+stdint
strftime
configure.ac:
diff --git a/tests/test-posixtm.c b/tests/test-posixtm.c
index 8400c39f3e..1ea68c29c2 100644
--- a/tests/test-posixtm.c
+++ b/tests/test-posixtm.c
@@ -34,7 +34,7 @@ struct posixtm_test
char const *in;
unsigned int syntax_bits;
bool valid;
- int64_t t_expected;
+ int_least64_t t_expected;
};
/* Test mainly with syntax_bits == 13
@@ -49,12 +49,17 @@ static struct posixtm_test const T[] =
/* These two tests fail on 64-bit Solaris up through at least
Solaris 10, which is off by one day for time stamps before
0001-01-01 00:00:00 UTC. */
- { "000001010000.00", 13, 1, -62167219200}, /* Sat Jan 1 00:00:00 0 */
- { "000012312359.59", 13, 1, -62135596801}, /* Fri Dec 31 23:59:59 0 */
-
- { "000101010000.00", 13, 1, -62135596800}, /* Sat Jan 1 00:00:00 1 */
- { "190112132045.51", 13, 1, -2147483649}, /* Fri Dec 13 20:45:51 1901 */
- { "190112132045.52", 13, 1, -2147483648}, /* Fri Dec 13 20:45:52 1901 */
+ { "000001010000.00", 13, 1,
+ - INT64_C (62167219200)},/* Sat Jan 1 00:00:00 0 */
+ { "000012312359.59", 13, 1,
+ - INT64_C (62135596801)},/* Fri Dec 31 23:59:59 0 */
+
+ { "000101010000.00", 13, 1,
+ - INT64_C (62135596800)},/* Sat Jan 1 00:00:00 1 */
+ { "190112132045.51", 13, 1,
+ - INT64_C (2147483649)},/* Fri Dec 13 20:45:51 1901 */
+ { "190112132045.52", 13, 1,
+ - INT64_C (2147483648)},/* Fri Dec 13 20:45:52 1901 */
{ "190112132045.53", 13, 1, -2147483647}, /* Fri Dec 13 20:45:53 1901 */
{ "190112132046.52", 13, 1, -2147483588}, /* Fri Dec 13 20:46:52 1901 */
{ "190112132145.52", 13, 1, -2147480048}, /* Fri Dec 13 21:45:52 1901 */
@@ -77,15 +82,18 @@ static struct posixtm_test const T[] =
{ "197013010000.00", 13, 0, 0}, /* -- */
{ "203801190314.06", 13, 1, 2147483646}, /* Tue Jan 19 03:14:06 2038 */
{ "203801190314.07", 13, 1, 2147483647}, /* Tue Jan 19 03:14:07 2038 */
- { "203801190314.08", 13, 1, 2147483648}, /* Tue Jan 19 03:14:08 2038 */
- { "999912312359.59", 13, 1, 253402300799}, /* Fri Dec 31 23:59:59 9999 */
+ { "203801190314.08", 13, 1,
+ INT64_C ( 2147483648)},/* Tue Jan 19 03:14:08 2038 */
+ { "999912312359.59", 13, 1,
+ INT64_C (253402300799)},/* Fri Dec 31 23:59:59 9999 */
{ "1112131415", 13, 1, 1323785700}, /* Tue Dec 13 14:15:00 2011 */
{ "1112131415.16", 13, 1, 1323785716}, /* Tue Dec 13 14:15:16 2011 */
{ "201112131415.16", 13, 1, 1323785716}, /* Tue Dec 13 14:15:16 2011 */
{ "191112131415.16", 13, 1, -1831974284}, /* Wed Dec 13 14:15:16 1911 */
{ "203712131415.16", 13, 1, 2144326516}, /* Sun Dec 13 14:15:16 2037 */
{ "3712131415.16", 13, 1, 2144326516}, /* Sun Dec 13 14:15:16 2037 */
- { "6812131415.16", 13, 1, 3122633716}, /* Thu Dec 13 14:15:16 2068 */
+ { "6812131415.16", 13, 1,
+ INT64_C ( 3122633716)},/* Thu Dec 13 14:15:16 2068 */
{ "6912131415.16", 13, 1, -1590284}, /* Sat Dec 13 14:15:16 1969 */
{ "7012131415.16", 13, 1, 29945716}, /* Sun Dec 13 14:15:16 1970 */
{ "1213141599", 2, 1, 945094500}, /* Mon Dec 13 14:15:00 1999 */