]>
Commit | Line | Data |
---|---|---|
a66067be RM |
1 | #include <stdio.h> |
2 | #include <stdlib.h> | |
e15f7de6 | 3 | #include <libc-diag.h> |
a66067be | 4 | |
11336c16 UD |
5 | int |
6 | main (int argc, char *argv[]) | |
a66067be RM |
7 | { |
8 | long long int n; | |
9 | int ret; | |
10 | ||
11 | n = -1; | |
12 | ret = sscanf ("1000", "%lld", &n); | |
ec4b0518 | 13 | printf ("%%lld: ret: %d, n: %Ld\n", ret, n); |
a66067be RM |
14 | if (ret != 1 || n != 1000L) |
15 | abort (); | |
16 | ||
17 | n = -2; | |
1c4053db RM |
18 | |
19 | /* We are testing a corner case of the scanf format string here. */ | |
20 | DIAG_PUSH_NEEDS_COMMENT; | |
21 | DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wformat"); | |
22 | DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wformat-extra-args"); | |
23 | ||
a66067be | 24 | ret = sscanf ("1000", "%llld", &n); |
1c4053db RM |
25 | |
26 | DIAG_POP_NEEDS_COMMENT; | |
27 | ||
a66067be | 28 | printf ("%%llld: ret: %d, n: %Ld\n", ret, n); |
77d10f94 | 29 | if (ret > 0 || n >= 0L) |
a66067be RM |
30 | abort (); |
31 | ||
32 | return 0; | |
33 | } |