summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnil Madhavapeddy <avsm@cvs.openbsd.org>2004-08-08 13:11:11 +0000
committerAnil Madhavapeddy <avsm@cvs.openbsd.org>2004-08-08 13:11:11 +0000
commit6ef5a56a66746c2c514430bfc93f651cc3e8a5ef (patch)
treef6769196c881a527af4f9523d7593fd0cbf02d5d
parentadaddf3b1f1a6260a9fe2d9eb21d2c1d1e23ea3f (diff)
check for variable sized array in format arguments
-rw-r--r--regress/gnu/egcs/gcc-bounds/Makefile4
-rw-r--r--regress/gnu/egcs/gcc-bounds/vararray-3.c10
-rw-r--r--regress/gnu/egcs/gcc-bounds/vararray-3.c.exp2
3 files changed, 14 insertions, 2 deletions
diff --git a/regress/gnu/egcs/gcc-bounds/Makefile b/regress/gnu/egcs/gcc-bounds/Makefile
index 88f09e27d86..305a92967ca 100644
--- a/regress/gnu/egcs/gcc-bounds/Makefile
+++ b/regress/gnu/egcs/gcc-bounds/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.8 2004/07/09 22:24:41 avsm Exp $
+# $OpenBSD: Makefile,v 1.9 2004/08/08 13:11:10 avsm Exp $
C_MODULES?= strlcpy strlcat getcwd memcpy fread memcpy declare \
sscanf vararray md builtins
@@ -11,7 +11,7 @@ C_MEMCPY= 1 2 3 4 5 6
C_FREAD= 1 2 3 4
C_DECLARE= 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
C_SSCANF= 1 2 3 4 5
-C_VARARRAY= 1 2
+C_VARARRAY= 1 2 3
C_MD= 1 2 3 4 5 6
C_BUILTINS= 1
diff --git a/regress/gnu/egcs/gcc-bounds/vararray-3.c b/regress/gnu/egcs/gcc-bounds/vararray-3.c
new file mode 100644
index 00000000000..b1d361f406d
--- /dev/null
+++ b/regress/gnu/egcs/gcc-bounds/vararray-3.c
@@ -0,0 +1,10 @@
+#include <stdio.h>
+
+int
+main(int argc, char **argv)
+{
+ int a;
+ char buf[10], buf2[a];
+ sscanf(buf, "%s", buf2);
+ return 1;
+}
diff --git a/regress/gnu/egcs/gcc-bounds/vararray-3.c.exp b/regress/gnu/egcs/gcc-bounds/vararray-3.c.exp
new file mode 100644
index 00000000000..91a07e6309f
--- /dev/null
+++ b/regress/gnu/egcs/gcc-bounds/vararray-3.c.exp
@@ -0,0 +1,2 @@
+vararray-3.c: In function `main':
+vararray-3.c:7: warning: ANSI C forbids variable-size array `buf2'