From fb6807b860ac9bdb2cb345a43b9c3bf398aca013 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Sat, 27 Mar 2010 14:40:08 +0100 Subject: [PATCH] re PR tree-optimization/43528 (ICE: in tree_low_cst, at tree.c:6198 with -mms-bitfields at x86_64-linux) PR tree-optimization/43528 * stor-layout.c (place_field): Check that constant fits into unsigned HWI when skipping calculation of MS bitfield layout. testsuite/ChangeLog: PR tree-optimization/43528 * gcc.target/i386/pr43528.c: New test. From-SVN: r157776 --- gcc/ChangeLog | 6 ++++++ gcc/stor-layout.c | 9 +++++---- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/pr43528.c | 5 +++++ 4 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr43528.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d4f4488e512e..393e7530b91c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2010-03-27 Uros Bizjak + + PR tree-optimization/43528 + * stor-layout.c (place_field): Check that constant fits into + unsigned HWI when skipping calculation of MS bitfield layout. + 2010-03-27 Jan Hubicka PR middle-end/43391 diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 1806c12189a6..18c74cb61076 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -1346,11 +1346,12 @@ place_field (record_layout_info rli, tree field) until we see a bitfield (and come by here again) we just skip calculating it. */ if (DECL_SIZE (field) != NULL - && host_integerp (TYPE_SIZE (TREE_TYPE (field)), 0) - && host_integerp (DECL_SIZE (field), 0)) + && host_integerp (TYPE_SIZE (TREE_TYPE (field)), 1) + && host_integerp (DECL_SIZE (field), 1)) { - HOST_WIDE_INT bitsize = tree_low_cst (DECL_SIZE (field), 1); - HOST_WIDE_INT typesize + unsigned HOST_WIDE_INT bitsize + = tree_low_cst (DECL_SIZE (field), 1); + unsigned HOST_WIDE_INT typesize = tree_low_cst (TYPE_SIZE (TREE_TYPE (field)), 1); if (typesize < bitsize) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 01c513b9e633..51cfa8b82b81 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-03-27 Uros Bizjak + + PR tree-optimization/43528 + * gcc.target/i386/pr43528.c: New test. + 2010-03-26 Joseph Myers PR c/43381 diff --git a/gcc/testsuite/gcc.target/i386/pr43528.c b/gcc/testsuite/gcc.target/i386/pr43528.c new file mode 100644 index 000000000000..f33d96b195cd --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr43528.c @@ -0,0 +1,5 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-options "-mms-bitfields" } */ + +struct S { int i[(1LL << 60) - 1]; };