From c8e62a9df15d4e16cca367057530a7847eeb943c Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Thu, 7 Jan 2016 17:13:50 +0000 Subject: [PATCH] Add a test for PR66655 PR target/66655 * g++.dg/pr66655.C: New test. * g++.dg/pr66655_1.cc: Test support file. * g++.dg/pr66655.h: Test header file. From-SVN: r232133 --- gcc/testsuite/ChangeLog | 7 +++++++ gcc/testsuite/g++.dg/pr66655.C | 25 +++++++++++++++++++++++++ gcc/testsuite/g++.dg/pr66655.h | 5 +++++ gcc/testsuite/g++.dg/pr66655_1.cc | 14 ++++++++++++++ 4 files changed, 51 insertions(+) create mode 100644 gcc/testsuite/g++.dg/pr66655.C create mode 100644 gcc/testsuite/g++.dg/pr66655.h create mode 100644 gcc/testsuite/g++.dg/pr66655_1.cc diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 869d0fb2841..c65c7cb58c4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2016-01-07 Nick Clifton + + PR target/66655 + * g++.dg/pr66655.C: New test. + * g++.dg/pr66655_1.cc: Test support file. + * g++.dg/pr66655.h: Test header file. + 2016-01-07 Dominique d'Humieres PR fortran/66680 diff --git a/gcc/testsuite/g++.dg/pr66655.C b/gcc/testsuite/g++.dg/pr66655.C new file mode 100644 index 00000000000..218a2c63eb3 --- /dev/null +++ b/gcc/testsuite/g++.dg/pr66655.C @@ -0,0 +1,25 @@ +/* { dg-do run } */ +/* { dg-additional-sources "pr66655_1.cc" } */ + +#include "pr66655.h" + +extern "C" void abort (void); + +#define COOKIE 0xabcd0123 + +int +g (void) +{ + return COOKIE; +} + +extern int f (void); + +int +main (void) +{ + S::set(0); + if (f () != COOKIE) + abort (); + return 0; +} diff --git a/gcc/testsuite/g++.dg/pr66655.h b/gcc/testsuite/g++.dg/pr66655.h new file mode 100644 index 00000000000..ff638f43970 --- /dev/null +++ b/gcc/testsuite/g++.dg/pr66655.h @@ -0,0 +1,5 @@ +struct S +{ + static int i; + static void set (int ii) { i = -ii; } +}; diff --git a/gcc/testsuite/g++.dg/pr66655_1.cc b/gcc/testsuite/g++.dg/pr66655_1.cc new file mode 100644 index 00000000000..d42344c4a04 --- /dev/null +++ b/gcc/testsuite/g++.dg/pr66655_1.cc @@ -0,0 +1,14 @@ +#include "pr66655.h" + +extern int g (void); + +int S::i; + +int +f (void) +{ + int ret = g (); + + S::set (ret); + return ret; +}