From 59c1f3840203780d04974b37b617ac0d673e8c4a Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Thu, 30 Apr 2015 18:01:07 +0000 Subject: [PATCH] re PR tree-optimization/63551 (wrong code (segfaults) at -Os on x86_64-linux-gnu) PR tree-optimization/63551 * g++.dg/ipa/pr63551.C: New test. From-SVN: r222650 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/ipa/pr63551.C | 23 +++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 gcc/testsuite/g++.dg/ipa/pr63551.C diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 00af2c42833..aa0123502c7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-04-30 Marek Polacek + + PR tree-optimization/63551 + * g++.dg/ipa/pr63551.C: New test. + 2015-04-30 Caroline Tice PR 65929 diff --git a/gcc/testsuite/g++.dg/ipa/pr63551.C b/gcc/testsuite/g++.dg/ipa/pr63551.C new file mode 100644 index 00000000000..03e03397969 --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/pr63551.C @@ -0,0 +1,23 @@ +// { dg-options "-O -Wno-psabi" } +// { dg-do compile } + +struct A { int a; }; +template struct B { V operator[] (T); }; +union U { long double ld; void *v; }; +A a; + +void +bar (U &x) +{ + if (x.v) *reinterpret_cast (x.v) = a; +} + +struct C { C (A) { c.ld = 0; bar (c); } U c; }; +struct D { A d, e; void foo () { f[0][d] = e; } B > f; }; + +void +baz () +{ + D d; + d.foo (); +} -- 2.30.2