diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2019-01-25 16:57:32 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2019-01-25 16:57:32 +0000 |
commit | 3c35efc322f7ff8d25b81cf9ebc01d0ec202bb89 (patch) | |
tree | 8c687e9e504a57ca6818174a9eb80e2cade73e41 /gcc/testsuite/gcc.dg/pr89037.c | |
parent | 62fa42ce812c699b8cc270b486ef8d644c0342de (diff) | |
download | gcc-3c35efc322f7ff8d25b81cf9ebc01d0ec202bb89.zip gcc-3c35efc322f7ff8d25b81cf9ebc01d0ec202bb89.tar.gz gcc-3c35efc322f7ff8d25b81cf9ebc01d0ec202bb89.tar.bz2 |
Fix output_constructor_bitfield handling of wide bitfields (PR89037)
The testcase was failing because we were trying to access
TREE_INT_CST_ELT (x, 1) of a 128-bit integer that was small enough
to need only a single element.
2019-01-25 Richard Sandiford <richard.sandiford@arm.com>
gcc/
PR middle-end/89037
* varasm.c (output_constructor_bitfield): Use wi::extract_uhwi
instead of accessing TREE_INT_CST_ELT directly.
gcc/testsuite/
PR middle-end/89037
* gcc.dg/pr89037.c: New test.
From-SVN: r268272
Diffstat (limited to 'gcc/testsuite/gcc.dg/pr89037.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/pr89037.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pr89037.c b/gcc/testsuite/gcc.dg/pr89037.c new file mode 100644 index 0000000..5511367 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr89037.c @@ -0,0 +1,24 @@ +/* { dg-do run { target int128 } } */ +/* { dg-options "" } */ + +struct s +{ + __int128 y : 66; +}; +typedef struct s T; +T a[] = { 1, 10000, 0x12345, 0xff000001, 1ULL << 63, (__int128) 1 << 64, + ((__int128) 1 << 64) | 1 }; + +int +main (void) +{ + if (a[0].y != 1 + || a[1].y != 10000 + || a[2].y != 0x12345 + || a[3].y != 0xff000001 + || a[4].y != (1ULL << 63) + || a[5].y != ((__int128) 1 << 64) + || a[6].y != (((__int128) 1 << 64) | 1)) + __builtin_abort (); + return 0; +} |