aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index e77d74e..1241b13 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -8104,11 +8104,12 @@ native_encode_initializer (tree init, unsigned char *ptr, int len,
{
if (valueinit == -1)
{
- tree zero = build_constructor (TREE_TYPE (type), NULL);
+ tree zero = build_zero_cst (TREE_TYPE (type));
r = native_encode_initializer (zero, ptr + curpos,
fieldsize, 0,
mask + curpos);
- ggc_free (zero);
+ if (TREE_CODE (zero) == CONSTRUCTOR)
+ ggc_free (zero);
if (!r)
return 0;
valueinit = curpos;
@@ -8255,8 +8256,9 @@ native_encode_initializer (tree init, unsigned char *ptr, int len,
{
cnt--;
field = fld;
- val = build_constructor (TREE_TYPE (fld), NULL);
- to_free = val;
+ val = build_zero_cst (TREE_TYPE (fld));
+ if (TREE_CODE (val) == CONSTRUCTOR)
+ to_free = val;
}
}