Blame stdio-common/scanf7.c
|
Packit Service |
82fcde |
#include <stdio.h>
|
|
Packit Service |
82fcde |
#include <stdlib.h>
|
|
Packit Service |
82fcde |
#include <libc-diag.h>
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
int
|
|
Packit Service |
82fcde |
main (int argc, char *argv[])
|
|
Packit Service |
82fcde |
{
|
|
Packit Service |
82fcde |
long long int n;
|
|
Packit Service |
82fcde |
int ret;
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
n = -1;
|
|
Packit Service |
82fcde |
ret = sscanf ("1000", "%lld", &n);
|
|
Packit Service |
82fcde |
printf ("%%lld: ret: %d, n: %Ld\n", ret, n);
|
|
Packit Service |
82fcde |
if (ret != 1 || n != 1000L)
|
|
Packit Service |
82fcde |
abort ();
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
n = -2;
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* We are testing a corner case of the scanf format string here. */
|
|
Packit Service |
82fcde |
DIAG_PUSH_NEEDS_COMMENT;
|
|
Packit Service |
82fcde |
DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wformat");
|
|
Packit Service |
82fcde |
DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wformat-extra-args");
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
ret = sscanf ("1000", "%llld", &n);
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
DIAG_POP_NEEDS_COMMENT;
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
printf ("%%llld: ret: %d, n: %Ld\n", ret, n);
|
|
Packit Service |
82fcde |
if (ret > 0 || n >= 0L)
|
|
Packit Service |
82fcde |
abort ();
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
return 0;
|
|
Packit Service |
82fcde |
}
|