[PATCH] Don't fold condition (again) in gfc_trans_runtime_check
Richard Guenther
rguenther@suse.de
Fri Jan 13 14:46:00 GMT 2006
Using grep is immediately followed by pressure to do some cleanups
again... As in, don't use fold () because it's not recursive, instead
use fold_buildN where appropriate.
Gone over all users of gfc_trans_runtime_check and verified we used
fold_buildN for the condition we pass to gfc_trans_runtime_check. Or
fixed it with this patch.
Ok for mainline?
Thanks,
Richard.
2006-01-13 Richard Guenther <rguenther@suse.de>
* trans-expr.c (gfc_conv_function_call): Use fold_build2.
* trans-stmt.c (gfc_trans_goto): Likewise. Use build_int_cst.
* trans.c (gfc_trans_runtime_check): Don't fold the condition
again.
Index: trans-expr.c
===================================================================
*** trans-expr.c (revision 109664)
--- trans-expr.c (working copy)
*************** gfc_conv_function_call (gfc_se * se, gfc
*** 1830,1836 ****
/* Check the data pointer hasn't been modified. This would
happen in a function returning a pointer. */
tmp = gfc_conv_descriptor_data_get (info->descriptor);
! tmp = build2 (NE_EXPR, boolean_type_node, tmp, info->data);
gfc_trans_runtime_check (tmp, gfc_strconst_fault, &se->pre);
}
se->expr = info->descriptor;
--- 1830,1837 ----
/* Check the data pointer hasn't been modified. This would
happen in a function returning a pointer. */
tmp = gfc_conv_descriptor_data_get (info->descriptor);
! tmp = fold_build2 (NE_EXPR, boolean_type_node,
! tmp, info->data);
gfc_trans_runtime_check (tmp, gfc_strconst_fault, &se->pre);
}
se->expr = info->descriptor;
Index: trans-stmt.c
===================================================================
*** trans-stmt.c (revision 109664)
--- trans-stmt.c (working copy)
*************** gfc_trans_goto (gfc_code * code)
*** 162,168 ****
assign_error =
gfc_build_cstring_const ("Assigned label is not a target label");
tmp = GFC_DECL_STRING_LEN (se.expr);
! tmp = build2 (NE_EXPR, boolean_type_node, tmp, integer_minus_one_node);
gfc_trans_runtime_check (tmp, assign_error, &se.pre);
assigned_goto = GFC_DECL_ASSIGN_ADDR (se.expr);
--- 162,169 ----
assign_error =
gfc_build_cstring_const ("Assigned label is not a target label");
tmp = GFC_DECL_STRING_LEN (se.expr);
! tmp = fold_build2 (NE_EXPR, boolean_type_node, tmp,
! build_int_cst (TREE_TYPE (tmp), -1));
gfc_trans_runtime_check (tmp, assign_error, &se.pre);
assigned_goto = GFC_DECL_ASSIGN_ADDR (se.expr);
Index: trans.c
===================================================================
*** trans.c (revision 109664)
--- trans.c (working copy)
*************** gfc_trans_runtime_check (tree cond, tree
*** 308,315 ****
tree tmp;
tree args;
- cond = fold (cond);
-
if (integer_zerop (cond))
return;
--- 308,313 ----
More information about the Gcc-patches
mailing list