summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2015-02-09 17:01:36 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2015-02-09 17:01:36 +0000
commit5300bef09ec5bfba9459b1d51df36a83f33f12ca (patch)
treeceda52eaeb57baf1c0dbf7e40eb9bd2804179661 /gcc/testsuite/gcc.c-torture
parent2f4777f3a5642980e54dbae3c6a0b62df9f2163a (diff)
downloadgcc-5300bef09ec5bfba9459b1d51df36a83f33f12ca.tar.gz
PR target/64979
* tree-stdarg.c (pass_stdarg::execute): Scan phi node args for va_list escapes. * gcc.dg/tree-ssa/stdarg-7.c: New test. * gcc.c-torture/execute/pr64979.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@220543 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.c-torture')
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr64979.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr64979.c b/gcc/testsuite/gcc.c-torture/execute/pr64979.c
new file mode 100644
index 00000000000..ccb46087e02
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr64979.c
@@ -0,0 +1,36 @@
+/* PR target/64979 */
+
+#include <stdarg.h>
+
+void __attribute__((noinline, noclone))
+bar (int x, va_list *ap)
+{
+ if (ap)
+ {
+ int i;
+ for (i = 0; i < 10; i++)
+ if (i != va_arg (*ap, int))
+ __builtin_abort ();
+ if (va_arg (*ap, double) != 0.5)
+ __builtin_abort ();
+ }
+}
+
+void __attribute__((noinline, noclone))
+foo (int x, ...)
+{
+ va_list ap;
+ int n;
+
+ va_start (ap, x);
+ n = va_arg (ap, int);
+ bar (x, (va_list *) ((n == 0) ? ((void *) 0) : &ap));
+ va_end (ap);
+}
+
+int
+main ()
+{
+ foo (100, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0.5);
+ return 0;
+}