about summary refs log tree commit diff
path: root/stdio-common/scanf11.c
diff options
context:
space:
mode:
Diffstat (limited to 'stdio-common/scanf11.c')
-rw-r--r--stdio-common/scanf11.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/stdio-common/scanf11.c b/stdio-common/scanf11.c
new file mode 100644
index 0000000000..50ef26aded
--- /dev/null
+++ b/stdio-common/scanf11.c
@@ -0,0 +1,14 @@
+/* This test comes from ISO C Corrigendum 1.  */
+#include <stdio.h>
+
+int
+main (int argc, char *argv[])
+{
+  int d1, n1, n2, i;
+#define NOISE 1234567
+  int d2 = NOISE;
+
+  i = sscanf ("123", "%d%n%n%d", &d1, &n1, &n2, &d2);
+
+  return i != 3 || d1 != 123 || n1 != 3 || n2 != 3 || d2 != NOISE;
+}