From f44157f84be4cc82697697136464ed7711595aa5 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 18 Aug 2011 16:29:10 +0200 Subject: [PATCH] re PR target/50009 (Segmentation fault in tree_nop_conversion) 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. From-SVN: r177860 --- gcc/ChangeLog | 4 ++++ gcc/stor-layout.c | 7 ++++--- gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/gcc.c-torture/compile/pr50009.c | 6 ++++++ 4 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr50009.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1b5bc6c1b9c..0c3c5af5c3e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2011-08-18 Jakub Jelinek + PR target/50009 + * stor-layout.c (update_alignment_for_field): Don't ICE on + packed flexible array members if ms_bitfield_layout_p. + PR target/50092 * config/i386/i386.c (assign_386_stack_local): Call validize_mem on the result before returning it. diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index e488741f5a0..f15da0ce30f 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -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_layout_info rli, tree field, 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) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 76e855480d4..99345f32dc3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2011-08-18 Jakub Jelinek + PR target/50009 + * gcc.c-torture/compile/pr50009.c: New test. + PR target/50092 * gcc.dg/torture/pr50092.c: New test. diff --git a/gcc/testsuite/gcc.c-torture/compile/pr50009.c b/gcc/testsuite/gcc.c-torture/compile/pr50009.c new file mode 100644 index 00000000000..ade170c7d48 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr50009.c @@ -0,0 +1,6 @@ +/* PR target/50009 */ + +struct S { + short a; + short b[]; +} __attribute__((packed)); -- 2.30.2