* gimplify.c (gimplify_expr): Set GS_ALL_DONE when appropriate.
Don't change GS_OK to GS_ALL_DONE. Make sure that all cases set
ret appropriately.
(gimplify_compound_lval): Return GS_ALL_DONE as appropriate.
gcc/cp:
* semantics.c (simplify_aggr_init_expr): Use INIT_EXPR.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159125
138bc75d-0d04-0410-961f-
82ee72b054a4
2010-05-06 Jason Merrill <jason@redhat.com>
2010-05-06 Jason Merrill <jason@redhat.com>
+ * gimplify.c (gimplify_expr): Set GS_ALL_DONE when appropriate.
+ Don't change GS_OK to GS_ALL_DONE. Make sure that all cases set
+ ret appropriately.
+ (gimplify_compound_lval): Return GS_ALL_DONE as appropriate.
+
* gimplify.c (gimplify_modify_expr_rhs): Don't return GS_OK for
stripping WITH_SIZE_EXPR.
(gimplify_expr) [MODIFY_EXPR]: Trust GS_OK even if the rhs didn't
* gimplify.c (gimplify_modify_expr_rhs): Don't return GS_OK for
stripping WITH_SIZE_EXPR.
(gimplify_expr) [MODIFY_EXPR]: Trust GS_OK even if the rhs didn't
+2010-05-06 Jason Merrill <jason@redhat.com>
+
+ * semantics.c (simplify_aggr_init_expr): Use INIT_EXPR.
+
2010-04-22 Jakub Jelinek <jakub@redhat.com>
Dodji Seketeli <dodji@redhat.com>
2010-04-22 Jakub Jelinek <jakub@redhat.com>
Dodji Seketeli <dodji@redhat.com>
expand_call{,_inline}. */
cxx_mark_addressable (slot);
CALL_EXPR_RETURN_SLOT_OPT (call_expr) = true;
expand_call{,_inline}. */
cxx_mark_addressable (slot);
CALL_EXPR_RETURN_SLOT_OPT (call_expr) = true;
- call_expr = build2 (MODIFY_EXPR, TREE_TYPE (call_expr), slot, call_expr);
+ call_expr = build2 (INIT_EXPR, TREE_TYPE (call_expr), slot, call_expr);
}
else if (style == pcc)
{
}
else if (style == pcc)
{
{
tree *p;
VEC(tree,heap) *stack;
{
tree *p;
VEC(tree,heap) *stack;
- enum gimplify_status ret = GS_OK, tret;
+ enum gimplify_status ret = GS_ALL_DONE, tret;
int i;
location_t loc = EXPR_LOCATION (*expr_p);
int i;
location_t loc = EXPR_LOCATION (*expr_p);
/* Create a stack of the subexpressions so later we can walk them in
order from inner to outer. */
/* Create a stack of the subexpressions so later we can walk them in
order from inner to outer. */
if ((fallback & fb_rvalue) && TREE_CODE (*expr_p) == COMPONENT_REF)
{
canonicalize_component_ref (expr_p);
if ((fallback & fb_rvalue) && TREE_CODE (*expr_p) == COMPONENT_REF)
{
canonicalize_component_ref (expr_p);
- ret = MIN (ret, GS_OK);
}
VEC_free (tree, heap, stack);
}
VEC_free (tree, heap, stack);
+ gcc_assert (*expr_p == expr || ret != GS_ALL_DONE);
+
else if (ret != GS_UNHANDLED)
break;
else if (ret != GS_UNHANDLED)
break;
+ /* Make sure that all the cases set 'ret' appropriately. */
+ ret = GS_UNHANDLED;
switch (TREE_CODE (*expr_p))
{
/* First deal with the special cases. */
switch (TREE_CODE (*expr_p))
{
/* First deal with the special cases. */
{
*expr_p = get_initialized_tmp_var (*expr_p, pre_p, post_p);
mark_addressable (*expr_p);
{
*expr_p = get_initialized_tmp_var (*expr_p, pre_p, post_p);
mark_addressable (*expr_p);
{
*expr_p = get_initialized_tmp_var (*expr_p, pre_p, post_p);
mark_addressable (*expr_p);
{
*expr_p = get_initialized_tmp_var (*expr_p, pre_p, post_p);
mark_addressable (*expr_p);
case INIT_EXPR:
ret = gimplify_modify_expr (expr_p, pre_p, post_p,
fallback != fb_none);
case INIT_EXPR:
ret = gimplify_modify_expr (expr_p, pre_p, post_p,
fallback != fb_none);
- /* Don't let the end of loop logic change GS_OK to GS_ALL_DONE;
- gimplify_modify_expr_rhs might have changed the RHS. */
- if (ret == GS_OK && *expr_p)
- continue;
break;
case TRUTH_ANDIF_EXPR:
break;
case TRUTH_ANDIF_EXPR:
/* Just strip a conversion to void (or in void context) and
try again. */
*expr_p = TREE_OPERAND (*expr_p, 0);
/* Just strip a conversion to void (or in void context) and
try again. */
*expr_p = TREE_OPERAND (*expr_p, 0);
case INDIRECT_REF:
*expr_p = fold_indirect_ref_loc (input_location, *expr_p);
if (*expr_p != save_expr)
case INDIRECT_REF:
*expr_p = fold_indirect_ref_loc (input_location, *expr_p);
if (*expr_p != save_expr)
+ {
+ ret = GS_OK;
+ break;
+ }
/* else fall through. */
case ALIGN_INDIRECT_REF:
case MISALIGNED_INDIRECT_REF:
/* else fall through. */
case ALIGN_INDIRECT_REF:
case MISALIGNED_INDIRECT_REF:
if (fallback & fb_lvalue)
ret = GS_ALL_DONE;
else
if (fallback & fb_lvalue)
ret = GS_ALL_DONE;
else
- *expr_p = DECL_INITIAL (*expr_p);
+ {
+ *expr_p = DECL_INITIAL (*expr_p);
+ ret = GS_OK;
+ }
}
gimplify_seq_add_stmt (pre_p,
gimple_build_goto (GOTO_DESTINATION (*expr_p)));
}
gimplify_seq_add_stmt (pre_p,
gimple_build_goto (GOTO_DESTINATION (*expr_p)));
break;
case PREDICT_EXPR:
break;
case PREDICT_EXPR:
append_to_statement_list (ce->value, &temp);
*expr_p = temp;
append_to_statement_list (ce->value, &temp);
*expr_p = temp;
+ ret = temp ? GS_OK : GS_ALL_DONE;
}
/* C99 code may assign to an array in a constructed
structure or union, and this has undefined behavior only
}
/* C99 code may assign to an array in a constructed
structure or union, and this has undefined behavior only
{
*expr_p = get_initialized_tmp_var (*expr_p, pre_p, post_p);
mark_addressable (*expr_p);
{
*expr_p = get_initialized_tmp_var (*expr_p, pre_p, post_p);
mark_addressable (*expr_p);
}
else
ret = GS_ALL_DONE;
}
else
ret = GS_ALL_DONE;
gimple_test_f, fallback);
gimplify_expr (&TREE_OPERAND (*expr_p, 1), pre_p, post_p,
is_gimple_val, fb_rvalue);
gimple_test_f, fallback);
gimplify_expr (&TREE_OPERAND (*expr_p, 1), pre_p, post_p,
is_gimple_val, fb_rvalue);
TREE_TYPE (*expr_p))))
{
*expr_p = tmp;
TREE_TYPE (*expr_p))))
{
*expr_p = tmp;
break;
}
/* Convert (void *)&a + 4 into (void *)&a[1]. */
break;
}
/* Convert (void *)&a + 4 into (void *)&a[1]. */
0)))))
{
*expr_p = fold_convert (TREE_TYPE (*expr_p), tmp);
0)))))
{
*expr_p = fold_convert (TREE_TYPE (*expr_p), tmp);
- /* If we replaced *expr_p, gimplify again. */
- if (ret == GS_OK && (*expr_p == NULL || *expr_p == save_expr))
- ret = GS_ALL_DONE;
+ gcc_assert (*expr_p || ret != GS_OK);