Do not propogate the range when converting from a reference to an integral
type.
gcc/
* tree-vrp.c (extract_range_from_unary_expr): Set a varying range
when a reference is converted to an integral type.
(cherry picked from openacc-gcc-9-branch commit
7f78056b7d6ce1ff2d55c03621b29c18dacecacd)
+2019-05-30 Kwok Cheung Yeung <kcy@codesourcery.com>
+
+ * tree-vrp.c (extract_range_from_unary_expr): Set a varying range
+ when a reference is converted to an integral type.
+
2019-05-20 Julian Brown <julian@codesourcery.com>
* gimplify.c (gimplify_adjust_omp_clauses_1): Support implied no_alloc
tree inner_type = op0_type;
tree outer_type = type;
+ /* Do not trust the range information when converting from a reference
+ type to a integral type, since the reference might be a type-punned
+ integer that could take the value zero. */
+ if (TREE_CODE (inner_type) == REFERENCE_TYPE
+ && !POINTER_TYPE_P (outer_type))
+ {
+ vr->set_varying ();
+ return;
+ }
+
/* If the expression involves a pointer, we are only interested in
determining if it evaluates to NULL [0, 0] or non-NULL (~[0, 0]).