aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDaniel Berlin <dberlin@dberlin.org>2005-06-02 02:08:02 +0000
committerDaniel Berlin <dberlin@gcc.gnu.org>2005-06-02 02:08:02 +0000
commit292a398fb78ca6012b17481992ffa220a62d2b96 (patch)
treee88167c1f3ba3028e1e78e4ced6d4794bc64cef5 /gcc
parent39da352fad54fd28370547680978640e5c4fae5a (diff)
downloadgcc-292a398fb78ca6012b17481992ffa220a62d2b96.zip
gcc-292a398fb78ca6012b17481992ffa220a62d2b96.tar.gz
gcc-292a398fb78ca6012b17481992ffa220a62d2b96.tar.bz2
re PR tree-optimization/21839 (ICE for missing V_DEFS caused by salias with empty structures)
2005-06-01 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/21839 * gimplify.c (zero_sized_field_decl): New function. (gimplify_init_ctor_eval): Use it. From-SVN: r100477
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/gimplify.c14
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr21839.c12
3 files changed, 33 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1531a27..8b879e5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2005-06-01 Daniel Berlin <dberlin@dberlin.org>
+
+ Fix PR tree-optimization/21839
+
+ * gimplify.c (zero_sized_field_decl): New function.
+ (gimplify_init_ctor_eval): Use it.
+
2005-06-01 Josh Conner <jconner@apple.com>
PR 21478
@@ -199,7 +206,6 @@
* Makefile.in: Update dependencies.
-
2005-06-01 Danny Smith <dannysmith@users.sourceforge.net>
* config/i386/cygming.h (NO_PROFILE_COUNTERS): Define.
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index a659e77..3370f44 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -2501,6 +2501,17 @@ gimplify_init_ctor_eval_range (tree object, tree lower, tree upper,
pre_p);
}
+/* Return true if FDECL is accessing a field that is zero sized. */
+
+static bool
+zero_sized_field_decl (tree fdecl)
+{
+ if (TREE_CODE (fdecl) == FIELD_DECL && DECL_SIZE (fdecl)
+ && integer_zerop (DECL_SIZE (fdecl)))
+ return true;
+ return false;
+}
+
/* A subroutine of gimplify_init_constructor. Generate individual
MODIFY_EXPRs for a CONSTRUCTOR. OBJECT is the LHS against which the
assignments should happen. LIST is the CONSTRUCTOR_ELTS of the
@@ -2533,6 +2544,9 @@ gimplify_init_ctor_eval (tree object, tree list, tree *pre_p, bool cleared)
so we don't have to figure out what's missing ourselves. */
gcc_assert (purpose);
+ if (zero_sized_field_decl (purpose))
+ continue;
+
/* If we have a RANGE_EXPR, we have to build a loop to assign the
whole range. */
if (TREE_CODE (purpose) == RANGE_EXPR)
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr21839.c b/gcc/testsuite/gcc.c-torture/compile/pr21839.c
new file mode 100644
index 0000000..c02085c
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr21839.c
@@ -0,0 +1,12 @@
+ typedef struct { } spinlock_t;
+typedef struct {
+ unsigned sequence;
+ spinlock_t lock;
+} seqlock_t;
+void ext3_new_inode(seqlock_t *rsv_seqlock)
+{
+ *rsv_seqlock = (seqlock_t) { 0, (spinlock_t) { } };
+
+}
+
+