summaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
authordberlin <dberlin@138bc75d-0d04-0410-961f-82ee72b054a4>2005-06-02 02:08:02 +0000
committerdberlin <dberlin@138bc75d-0d04-0410-961f-82ee72b054a4>2005-06-02 02:08:02 +0000
commit5d7bbf40fca8537c4d4fd1c9a1db5b0db017277e (patch)
treee88167c1f3ba3028e1e78e4ced6d4794bc64cef5 /gcc/gimplify.c
parent8be91f463371dbefd72844443768c5368156d031 (diff)
downloadgcc-5d7bbf40fca8537c4d4fd1c9a1db5b0db017277e.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@100477 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index a659e77bb83..3370f449d01 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)