From 800469aa7330c409ac925b018473d8f9afe50079 Mon Sep 17 00:00:00 2001 From: jakub Date: Mon, 18 Mar 2013 07:10:33 +0000 Subject: PR c/56566 * tree.c (tree_int_cst_min_precision): For integer_zerop (value) return 1 even for !unsignedp. * c-c++-common/pr56566.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@196767 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 98ad5d8784b..31f8037deb8 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -6648,8 +6648,6 @@ tree_int_cst_sgn (const_tree t) unsigned int tree_int_cst_min_precision (tree value, bool unsignedp) { - int log; - /* If the value is negative, compute its negative minus 1. The latter adjustment is because the absolute value of the largest negative value is one larger than the largest positive value. This is equivalent to @@ -6659,14 +6657,14 @@ tree_int_cst_min_precision (tree value, bool unsignedp) value = fold_build1 (BIT_NOT_EXPR, TREE_TYPE (value), value); /* Return the number of bits needed, taking into account the fact - that we need one more bit for a signed than unsigned type. */ + that we need one more bit for a signed than unsigned type. + If value is 0 or -1, the minimum precision is 1 no matter + whether unsignedp is true or false. */ if (integer_zerop (value)) - log = 0; + return 1; else - log = tree_floor_log2 (value); - - return log + 1 + !unsignedp; + return tree_floor_log2 (value) + 1 + !unsignedp; } /* Compare two constructor-element-type constants. Return 1 if the lists -- cgit v1.2.1 From 8e966116ccd5aef7a3965e4375e9ed2384357303 Mon Sep 17 00:00:00 2001 From: rguenth Date: Thu, 21 Mar 2013 11:53:39 +0000 Subject: 2013-03-21 Richard Biener * tree.h (DECL_DEBUG_EXPR_IS_FROM): Rename to ... (DECL_HAS_DEBUG_EXPR_P): ... this. Guard properly. * tree.c (copy_node_stat): Do not copy DECL_HAS_DEBUG_EXPR_P. * dwarf2out.c (add_var_loc_to_decl): Use DECL_HAS_DEBUG_EXPR_P instead of DECL_DEBUG_EXPR_IS_FROM. * gimplify.c (gimplify_modify_expr): Likewise. * tree-cfg.c (verify_expr_location_1): Likewise. * tree-complex.c (create_one_component_var): Likewise. * tree-sra.c (create_access_replacement): Likewise. * tree-ssa-live.c (clear_unused_block_pointer_1): Likewise. (clear_unused_block_pointer): Likewise. * tree-streamer-in.c (unpack_ts_decl_common_value_fields): Likewise. * tree-streamer-out.c (pack_ts_decl_common_value_fields): Likewise. * var-tracking.c (var_debug_decl): Likewise. (track_expr_p): Likewise. * tree-inline.c (add_local_variables): Likewise. Set DECL_HAS_DEBUG_EXPR_P after copying it. * tree-diagnostic.c (default_tree_printer): Use DECL_HAS_DEBUG_EXPR_P instead of DECL_DEBUG_EXPR_IS_FROM. Guard properly. c/ * c-objc-common.c (c_tree_printer): Use DECL_HAS_DEBUG_EXPR_P instead of DECL_DEBUG_EXPR_IS_FROM. Guard properly. cp/ * error.c (cp_printer): Use DECL_HAS_DEBUG_EXPR_P instead of DECL_DEBUG_EXPR_IS_FROM. Guard properly. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@196864 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 31f8037deb8..65bc15f7637 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -975,6 +975,9 @@ copy_node_stat (tree node MEM_STAT_DECL) SET_DECL_VALUE_EXPR (t, DECL_VALUE_EXPR (node)); DECL_HAS_VALUE_EXPR_P (t) = 1; } + /* DECL_DEBUG_EXPR is copied explicitely by callers. */ + if (TREE_CODE (node) == VAR_DECL) + DECL_HAS_DEBUG_EXPR_P (t) = 0; if (TREE_CODE (node) == VAR_DECL && DECL_HAS_INIT_PRIORITY_P (node)) { SET_DECL_INIT_PRIORITY (t, DECL_INIT_PRIORITY (node)); -- cgit v1.2.1