diff options
author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-05-21 10:02:07 +0000 |
---|---|---|
committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-05-21 10:02:07 +0000 |
commit | 126740ee0b6facfc578078874afbaaf3b3bffaf7 (patch) | |
tree | 2b828b4c72f7f8ac16899fa066373c29a62932a3 /gcc/gimplify.c | |
parent | 65138c0ff40249e047e497d5950bcb0a8505280c (diff) | |
download | gcc-126740ee0b6facfc578078874afbaaf3b3bffaf7.tar.gz |
PR middle-end/44101
* gimplify.c (gimplify_init_constructor): Build a VIEW_CONVERT_EXPR
around the uniquized constructor if its type requires a conversion.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159655 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r-- | gcc/gimplify.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 8f19cedb053..f5bd994ffbb 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -3813,8 +3813,11 @@ gimplify_init_constructor (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, if (notify_temp_creation) return GS_ERROR; - walk_tree (&ctor, force_labels_r, NULL, NULL); - TREE_OPERAND (*expr_p, 1) = tree_output_constant_def (ctor); + walk_tree (&ctor, force_labels_r, NULL, NULL); + ctor = tree_output_constant_def (ctor); + if (!useless_type_conversion_p (type, TREE_TYPE (ctor))) + ctor = build1 (VIEW_CONVERT_EXPR, type, ctor); + TREE_OPERAND (*expr_p, 1) = ctor; /* This is no longer an assignment of a CONSTRUCTOR, but we still may have processing to do on the LHS. So |