Hi.
The PR is about use-after-scope issue where:
wi::tree_to_wide_ref andw = wi::to_wide (val) & wi::to_wide (boundary);
The RHS1 and RHS2 will become out-of-scope after operator& returns a reference.
andw.val then points to one of RHS1 or RHS2. So that we end up with an
use-after-scope.
Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
Ready to be installed?
Thanks,
Martin
gcc/ChangeLog:
2019-05-23 Martin Liska <[email protected]>
PR c++/90587.
* tree-ssa-uninit.c (value_sat_pred_p): The result of &
operation points to a temporary (pointed via tree_to_wide_ref)
that is out of scope after the &.
---
gcc/tree-ssa-uninit.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/tree-ssa-uninit.c b/gcc/tree-ssa-uninit.c
index bc07afe32c8..fe8f8f0bc28 100644
--- a/gcc/tree-ssa-uninit.c
+++ b/gcc/tree-ssa-uninit.c
@@ -1058,7 +1058,7 @@ value_sat_pred_p (tree val, tree boundary, enum tree_code cmpc,
if (cmpc != BIT_AND_EXPR)
return is_value_included_in (val, boundary, cmpc);
- wi::tree_to_wide_ref andw = wi::to_wide (val) & wi::to_wide (boundary);
+ wide_int andw = wi::to_wide (val) & wi::to_wide (boundary);
if (exact_p)
return andw == wi::to_wide (val);
else