From af68c1b73c33717577ed66fd83896714cd81b0e2 Mon Sep 17 00:00:00 2001 From: Oleg Endo Date: Sat, 7 Mar 2015 16:12:41 +0000 Subject: [PATCH] re PR target/65249 (unable to find a register to spill in class 'R0_REGS' when compiling protobuf on sh4) gcc/testsuite/ PR target/65249 * g++.dg/torture/pr65249.C: New. From-SVN: r221256 --- gcc/testsuite/ChangeLog | 5 +++ gcc/testsuite/g++.dg/torture/pr65249.C | 54 ++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 gcc/testsuite/g++.dg/torture/pr65249.C diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d89338032a9..baa485aa681 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-03-07 Oleg Endo + + PR target/65249 + * g++.dg/torture/pr65249.C: New. + 2015-03-07 H.J. Lu * gcc.target/i386/pr45685.c (uint64_t): Replace long with long diff --git a/gcc/testsuite/g++.dg/torture/pr65249.C b/gcc/testsuite/g++.dg/torture/pr65249.C new file mode 100644 index 00000000000..980d506bee6 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr65249.C @@ -0,0 +1,54 @@ +// { dg-do compile } +// { dg-additional-options "-fPIC -fstack-protector-strong" { target fpic } } +// { dg-require-effective-target fstack_protector } + +struct struct0 +{ + struct0 (void(*)()); +}; + +int func5 (int* ptr); +void func3 (int*, struct0*); + +inline void +func4 (int* a, void (*b)()) +{ + if (func5 (a) != 2) + { + struct0 f (b); + func3(a, &f); + } +} + +struct struct1 +{ + const void* val0; + const void* val1; +}; + +void* func3 (const void*); + +static const void* gvar1 = 0; +static const void* gvar2 = 0; +static int gvar0 = 0; + +void +func0 (void) +{ + gvar2 = func3 (gvar1); +} + +inline void +func1 (void) +{ + func4 (&gvar0, &func0); +} + +struct1 func2 (void) +{ + func1 (); + struct1 s; + s.val0 = gvar1; + s.val1 = gvar2; + return s; +} -- 2.30.2