struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug-3474.c
blob5ac330fe87839c0039dc476c297f8aa59154c31b
1 /* bug-3474.c
2 strtoul failed to report the error for some overflow corner cases.
3 */
5 #include <testfwk.h>
7 #include <stdlib.h>
8 #include <limits.h>
9 #include <errno.h>
11 void
12 testBug (void)
14 #if ULONG_MAX <= 0xffffffff
15 #if !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) && !defined(__SDCC_mcs51) // Lack of memory. TODO: Enable once strtoul uses a more efficient implementation.
16 char s[] = "5000000000";
17 unsigned long l = strtoul(s, NULL, 10);
18 ASSERT(l == ULONG_MAX);
19 ASSERT(errno == ERANGE);
20 #endif
21 #endif