From 6a46a28c3aef7ec1f2f5d583ece96bef6a27ff7f Mon Sep 17 00:00:00 2001 From: thopre01 Date: Fri, 8 Jan 2016 09:21:19 +0000 Subject: 2016-01-08 Thomas Preud'homme gcc/ PR tree-optimization/67781 * tree-ssa-math-opts.c (find_bswap_or_nop): Zero out bytes in cmpxchg and cmpnop in two steps: first the ones not accessed in original gimple expression in a endian independent way and then the ones not accessed in the final result in an endian-specific way. gcc/testsuite/ PR tree-optimization/67781 * gcc.c-torture/execute/pr67781.c: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@232154 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/gcc.c-torture/execute/pr67781.c | 34 +++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr67781.c (limited to 'gcc/testsuite/gcc.c-torture/execute') diff --git a/gcc/testsuite/gcc.c-torture/execute/pr67781.c b/gcc/testsuite/gcc.c-torture/execute/pr67781.c new file mode 100644 index 00000000000..bf50aa2f6c3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr67781.c @@ -0,0 +1,34 @@ +#ifdef __UINT32_TYPE__ +typedef __UINT32_TYPE__ uint32_t; +#else +typedef unsigned uint32_t; +#endif + +#ifdef __UINT8_TYPE__ +typedef __UINT8_TYPE__ uint8_t; +#else +typedef unsigned char uint8_t; +#endif + +struct +{ + uint32_t a; + uint8_t b; +} s = { 0x123456, 0x78 }; + +int pr67781() +{ + uint32_t c = (s.a << 8) | s.b; + return c; +} + +int +main () +{ + if (sizeof (uint32_t) * __CHAR_BIT__ != 32) + return 0; + + if (pr67781 () != 0x12345678) + __builtin_abort (); + return 0; +} -- cgit v1.2.1