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/opt/20050511-1.C | 70 +++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 gcc/testsuite/g++.dg/opt/20050511-1.C (limited to 'gcc/testsuite/g++.dg/opt/20050511-1.C') diff --git a/gcc/testsuite/g++.dg/opt/20050511-1.C b/gcc/testsuite/g++.dg/opt/20050511-1.C new file mode 100644 index 000000000..a8929030a --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/20050511-1.C @@ -0,0 +1,70 @@ +/* { dg-do run } */ +/* { dg-options "-w" } */ +/* { dg-options "-O3 -w" { target powerpc*-*-* } } */ +#include +#include + +// The VxWorks kernel headers define their own UINT32 +#if defined __vxworks && !defined __RTP__ +#define UINT32 my_UINT32 +#endif + +typedef signed short SINT16 ; +typedef unsigned long UINT32 ; +typedef unsigned int UINT ; + +class A +{ +public: + union + { + SINT16 xy[2]; + UINT32 abXY; + }; + bool operator==(const A& other) const {return abXY == other.abXY;} + bool operator!=(const A& other) const {return abXY != other.abXY;} +}; + +template struct pArray { unsigned char u08[16*(((size*1)+15)/16)] __attribute__ ((aligned(16))); }; + +struct B +{ + union { + A mvL[2]; + pArray<1> xyz; + }; +} ; + +typedef struct +{ + UINT w; + B b; + +}C; + + +UINT32 bar (const C * sPtr) +{ + UINT w = sPtr->w; + A a; + + a.xy[0] = sPtr->b.mvL[w].xy[0]<<2; + a.xy[1] = sPtr->b.mvL[w].xy[1]<<2; + + if (a.xy[0] != ((SINT16) 0xffff << 2)) + abort (); +} + +int main() +{ + A a; + C c; + a.xy[0] = 0xffff; + a.xy[1] = 0xffff; + c.w=0; + c.b.mvL[0].xy[0] = a.xy[0]; + c.b.mvL[0].xy[1] = a.xy[1]; + + bar (&c); +} + -- cgit v1.2.3