Hi! For targetm.ms_bitfield_layout_p we ICE on DECL_PACKED flexible array members, as they have NULL DECL_SIZE. We shouldn't adjust anything in that case like we don't adjust anything for non-zero sized fields.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2011-08-18 Jakub Jelinek <ja...@redhat.com> PR target/50009 * stor-layout.c (update_alignment_for_field): Don't ICE on packed flexible array members if ms_bitfield_layout_p. * gcc.c-torture/compile/pr50009.c: New test. --- gcc/stor-layout.c.jj 2011-08-03 18:41:06.000000000 +0200 +++ gcc/stor-layout.c 2011-08-18 12:17:57.000000000 +0200 @@ -1,7 +1,7 @@ /* C-compiler utilities for types and variables storage layout Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1996, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, + 2011 Free Software Foundation, Inc. This file is part of GCC. @@ -935,7 +935,8 @@ update_alignment_for_field (record_layou applies if there was an immediately prior, nonzero-size bitfield. (That's the way it is, experimentally.) */ if ((!is_bitfield && !DECL_PACKED (field)) - || (!integer_zerop (DECL_SIZE (field)) + || ((DECL_SIZE (field) == NULL_TREE + || !integer_zerop (DECL_SIZE (field))) ? !DECL_PACKED (field) : (rli->prev_field && DECL_BIT_FIELD_TYPE (rli->prev_field) --- gcc/testsuite/gcc.c-torture/compile/pr50009.c.jj 2011-08-18 12:19:43.000000000 +0200 +++ gcc/testsuite/gcc.c-torture/compile/pr50009.c 2011-08-18 12:19:21.000000000 +0200 @@ -0,0 +1,6 @@ +/* PR target/50009 */ + +struct S { + short a; + short b[]; +} __attribute__((packed)); Jakub