X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=blobdiff_plain;f=gcc%2Ftree-vrp.c;h=e8fec59264075a2a56bd3f417d2a25f28bd56e64;hp=4a018f73c17555b69ba1e1430d32b2483e39d461;hb=1a96c96a90b1a4581bb04b9d6d6fb99e754c11bc;hpb=1011516ddd4f4091efc1881eda095a323825aad5 diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 4a018f73c17..e8fec592640 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -695,17 +695,22 @@ get_value_range (const_tree var) /* If VAR is a default definition of a parameter, the variable can take any value in VAR's type. */ sym = SSA_NAME_VAR (var); - if (SSA_NAME_IS_DEFAULT_DEF (var) - && TREE_CODE (sym) == PARM_DECL) - { - /* Try to use the "nonnull" attribute to create ~[0, 0] - anti-ranges for pointers. Note that this is only valid with - default definitions of PARM_DECLs. */ - if (POINTER_TYPE_P (TREE_TYPE (sym)) - && nonnull_arg_p (sym)) + if (SSA_NAME_IS_DEFAULT_DEF (var)) + { + if (TREE_CODE (sym) == PARM_DECL) + { + /* Try to use the "nonnull" attribute to create ~[0, 0] + anti-ranges for pointers. Note that this is only valid with + default definitions of PARM_DECLs. */ + if (POINTER_TYPE_P (TREE_TYPE (sym)) + && nonnull_arg_p (sym)) + set_value_range_to_nonnull (vr, TREE_TYPE (sym)); + else + set_value_range_to_varying (vr); + } + else if (TREE_CODE (sym) == RESULT_DECL + && DECL_BY_REFERENCE (sym)) set_value_range_to_nonnull (vr, TREE_TYPE (sym)); - else - set_value_range_to_varying (vr); } return vr;