From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- gcc/testsuite/g++.dg/tree-ssa/pr13146.C | 77 +++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 gcc/testsuite/g++.dg/tree-ssa/pr13146.C (limited to 'gcc/testsuite/g++.dg/tree-ssa/pr13146.C') diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr13146.C b/gcc/testsuite/g++.dg/tree-ssa/pr13146.C new file mode 100644 index 000000000..22baf03d3 --- /dev/null +++ b/gcc/testsuite/g++.dg/tree-ssa/pr13146.C @@ -0,0 +1,77 @@ +/* { dg-do link } */ +/* { dg-options "-O -fstrict-aliasing" } */ + +class first +{ +public: + double d; + int f1; +}; + +class middle : public first +{ +}; + +class second : public middle +{ +public: + int f2; + short a; +}; + +class third +{ +public: + char a; + char b; +}; + +class multi: public third, public second +{ +public: + short s; + /* The following field used to be of type char but that causes + class multi to effectively get alias-set zero which we end + up not optimizing because of the fix for PR44164. */ + int f3; +}; + +extern void link_error (); + +void +foo (first *s1, second *s2) +{ + s1->f1 = 0; + s2->f2 = 0; + s1->f1++; + s2->f2++; + s1->f1++; + s2->f2++; + if (s1->f1 != 2) + link_error (); +} + +void +bar (first *s1, multi *s3) +{ + s1->f1 = 0; + s3->f3 = 0; + s1->f1++; + s3->f3++; + s1->f1++; + s3->f3++; + if (s1->f1 != 2) + link_error (); +} + + +int +main() +{ + first a; + second b; + multi c; + foo (&a, &b); + bar (&a, &c); + return 0; +} -- cgit v1.2.3