diff options
author | clyon <clyon@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-11-03 15:39:32 +0000 |
---|---|---|
committer | clyon <clyon@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-11-03 15:39:32 +0000 |
commit | 53f02ba9e2f9c3c84b085408706eda99625ce2d1 (patch) | |
tree | 1503ec2602940b42f75718e185a46d6edee94389 /gcc/testsuite/gcc.c-torture/execute/bitfld-6.c | |
parent | 22fc8281bfb4e05bf989a410a1cd5c85b7edbbb1 (diff) | |
download | gcc-53f02ba9e2f9c3c84b085408706eda99625ce2d1.tar.gz |
Merge branches/gcc-4_8-branch rev 216856
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/linaro/gcc-4_8-branch@217046 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/execute/bitfld-6.c')
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/bitfld-6.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/bitfld-6.c b/gcc/testsuite/gcc.c-torture/execute/bitfld-6.c new file mode 100644 index 00000000000..50927dc1d53 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/bitfld-6.c @@ -0,0 +1,23 @@ +union U +{ + const int a; + unsigned b : 20; +}; + +static union U u = { 0x12345678 }; + +/* Constant folding used to fail to account for endianness when folding a + union. */ + +int +main (void) +{ +#ifdef __BYTE_ORDER__ +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ + return u.b - 0x45678; +#else + return u.b - 0x12345; +#endif +#endif + return 0; +} |