aboutsummaryrefslogtreecommitdiff
path: root/gcc/builtins.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2007-01-08 22:53:20 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2007-01-08 22:53:20 +0000
commit2ac7cbb53296e6006d7c113d81175dd455fd570b (patch)
treec7ad9e6d3d7b86c201aaecf9a0017fb8badea1c3 /gcc/builtins.c
parent1c61ff294690d6ce7c9e958f62ab48a441943844 (diff)
downloadgcc-2ac7cbb53296e6006d7c113d81175dd455fd570b.zip
gcc-2ac7cbb53296e6006d7c113d81175dd455fd570b.tar.gz
gcc-2ac7cbb53296e6006d7c113d81175dd455fd570b.tar.bz2
tree.h (build_int_cst_wide_type): Export.
2007-01-08 Richard Guenther <rguenther@suse.de> * tree.h (build_int_cst_wide_type): Export. * tree.c (build_int_cst_wide_type): New function. (build_int_cst_wide): Fix comment. * builtins.c (fold_builtin_object_size): Use build_int_cst to build -1 or 0 of the correct type. Use fit_double_type to check for overflow. * fold-const.c (optimize_bit_field_compare): Use build_int_cst_type to build the mask. (decode_field_reference): Likewise. (all_ones_mask_p): Likewise. (native_interpret_int): Use build_int_cst_wide_type. (fold_binary): Use build_int_cst_type to build an all-ones value. * stor-layout.c (set_sizetype): Use build_int_cst_wide_type. java/ * lex.c (do_java_lex): Use build_int_cst_wide_type. * jcf-parse.c (get_constant): Likewise. cp/ * cvt.c (cp_convert_to_pointer): Use build_int_cst_type. ada/ * cuintp.c (build_cst_from_int): Use built_int_cst_type. * trans.c (gnat_to_gnu): Likewise. From-SVN: r120596
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r--gcc/builtins.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index a39a4c1..ad85034 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -10808,13 +10808,11 @@ fold_builtin_object_size (tree arglist)
if there are any side-effects, it returns (size_t) -1 for types 0 and 1
and (size_t) 0 for types 2 and 3. */
if (TREE_SIDE_EFFECTS (ptr))
- return fold_convert (size_type_node,
- object_size_type < 2
- ? integer_minus_one_node : integer_zero_node);
+ return build_int_cst_type (size_type_node, object_size_type < 2 ? -1 : 0);
if (TREE_CODE (ptr) == ADDR_EXPR)
ret = build_int_cstu (size_type_node,
- compute_builtin_object_size (ptr, object_size_type));
+ compute_builtin_object_size (ptr, object_size_type));
else if (TREE_CODE (ptr) == SSA_NAME)
{
@@ -10831,9 +10829,10 @@ fold_builtin_object_size (tree arglist)
if (ret)
{
- ret = force_fit_type (ret, -1, false, false);
- if (TREE_CONSTANT_OVERFLOW (ret))
- ret = 0;
+ unsigned HOST_WIDE_INT low = TREE_INT_CST_LOW (ret);
+ HOST_WIDE_INT high = TREE_INT_CST_HIGH (ret);
+ if (fit_double_type (low, high, &low, &high, TREE_TYPE (ret)))
+ ret = NULL_TREE;
}
return ret;