[Various] libc/1864: strtol does not return 0xFFFFFFFFFFFF00FF when fed "0xFFFFFFFFFFFF00FF"
Andreas Jaeger
aj@suse.de
Mon Aug 21 08:39:00 GMT 2000
We've received the appended bug report. Can anybody clarify this,
please?
If I understand this correctly, the basic question is whether strtol
handles:
Numbers > 0x8000000000000000 as a negative number - or not.
Btw. this works with strtoul. I've added this as a testcase to
tst-strtol and tst-strtoll. Please tell me if the tests cases are
correct (in this case the report is wrong) - or wrong and we need to
fix strtol/strtoll.
Andreas
2000-08-21 Andreas Jaeger <aj@suse.de>
* stdlib/tst-strtol.c: Add test for 0xFFFFFFFFFFFF00FF (from PR
libc/1864).
* stdlib/tst-strtoll.c: Likewise.
============================================================
Index: stdlib/tst-strtol.c
--- stdlib/tst-strtol.c 2000/05/23 08:42:56 1.18
+++ stdlib/tst-strtol.c 2000/08/21 15:37:04
@@ -54,7 +54,7 @@
{"yz!", 34 * 36 + 35, 36, '!', 0},
{"-yz", -(34*36 + 35), 36, 0, 0},
{"GhI4", ((16*20 + 17)*20 + 18)*20 + 4, 20, 0, 0},
-
+
/* extremes... */
#if LONG_MAX == 0x7fffffff
{"2147483647", 2147483647, 0, 0, 0},
@@ -73,6 +73,7 @@
{"-9223372036854775808", -9223372036854775808, 0, 0, 0},
{"-9223372036854775809", -9223372036854775808, 0, 0, ERANGE},
{"0x112233445566778899z", 9223372036854775807, 16, 'z', ERANGE},
+ {"0xFFFFFFFFFFFF00FF" , 9223372036854775807, 0, 0, ERANGE},
#endif
{NULL, 0, 0, 0, 0},
============================================================
Index: stdlib/tst-strtoll.c
--- stdlib/tst-strtoll.c 2000/05/23 08:42:56 1.3
+++ stdlib/tst-strtoll.c 2000/08/21 15:37:04
@@ -68,6 +68,7 @@
{"-9223372036854775808", -9223372036854775807ll - 1, 0, 0, 0},
{"-9223372036854775809", -9223372036854775807ll - 1, 0, 0, ERANGE},
{"0x112233445566778899z", 9223372036854775807ll, 16, 'z', ERANGE},
+ {"0xFFFFFFFFFFFF00FF" , 9223372036854775807ll, 0, 0, ERANGE},
{NULL, 0, 0, 0, 0},
/* Then unsigned. */
More information about the Libc-alpha
mailing list