diff options
author | Richard Biener <rguenther@suse.de> | 2022-08-19 14:12:52 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2022-08-22 08:17:24 +0200 |
commit | c77fae1ca796d6ea06d5cd437909905c3d3d771c (patch) | |
tree | 7fcf868410795cb8909115d3c18912e080e4c71a /libcpp | |
parent | e66cf626c72d5872fc3181e81535afbff7263287 (diff) | |
download | gcc-c77fae1ca796d6ea06d5cd437909905c3d3d771c.zip gcc-c77fae1ca796d6ea06d5cd437909905c3d3d771c.tar.gz gcc-c77fae1ca796d6ea06d5cd437909905c3d3d771c.tar.bz2 |
tree-optimization/105937 - avoid uninit diagnostics crossing iterations
The following avoids adding PHIs to the worklist for uninit processing
if we reach them following backedges. That confuses predicate analysis
because it assumes the use is happening in the same iteration as the the
definition. For the testcase in the PR the situation is like
void foo (int val)
{
int uninit;
# val = PHI <..> (B)
for (..)
{
if (..)
{
.. = val; (C)
val = uninit;
}
# val = PHI <..> (A)
}
}
and starting from (A) with 'uninit' as argument we arrive at (B)
and from there at (C). Predicate analysis then tries to prove
the predicate of (B) (not the backedge) can prove that the
path from (B) to (C) is unreachable which isn't really what it
necessary - that's what we'd need to do when the preheader
edge of the loop were the edge with the uninitialized def.
So the following makes those cases intentionally false negatives.
PR tree-optimization/105937
* tree-ssa-uninit.cc (find_uninit_use): Do not queue PHIs
on backedges.
(execute_late_warn_uninitialized): Mark backedges.
* g++.dg/uninit-pr105937.C: New testcase.
Diffstat (limited to 'libcpp')
0 files changed, 0 insertions, 0 deletions