summaryrefslogtreecommitdiff
path: root/regress/gnu/egcs/gcc-builtins/stpcpy-1.c
diff options
context:
space:
mode:
authorMartynas Venckus <martynas@cvs.openbsd.org>2013-12-28 02:14:33 +0000
committerMartynas Venckus <martynas@cvs.openbsd.org>2013-12-28 02:14:33 +0000
commitc639aa8fff0ddf4a97eebfacc435c2c44b1c316f (patch)
tree329af5562eb85f0e0a5d8e30d6317a0d662c1ef9 /regress/gnu/egcs/gcc-builtins/stpcpy-1.c
parent71e30afaecd3a65722d13c869cf0c018c37621eb (diff)
Add regression tests to check whether GCC folds unsafe builtins and
actually shows the security warning. Also add some other cases where GCC used to yield the warning but shouldn't (e.g. strncat simplified into strcat).
Diffstat (limited to 'regress/gnu/egcs/gcc-builtins/stpcpy-1.c')
-rw-r--r--regress/gnu/egcs/gcc-builtins/stpcpy-1.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/regress/gnu/egcs/gcc-builtins/stpcpy-1.c b/regress/gnu/egcs/gcc-builtins/stpcpy-1.c
new file mode 100644
index 00000000000..d9506280903
--- /dev/null
+++ b/regress/gnu/egcs/gcc-builtins/stpcpy-1.c
@@ -0,0 +1,13 @@
+#include <string.h>
+
+int
+main(int argc, char **argv)
+{
+ char buf[512];
+ volatile char *rv;
+
+ /* This expression cannot be folded. */
+ rv = stpcpy(buf, argv[0]);
+
+ return (1);
+}