diff options
author | David Malcolm <dmalcolm@redhat.com> | 2022-07-06 07:27:45 -0400 |
---|---|---|
committer | David Malcolm <dmalcolm@redhat.com> | 2022-07-06 07:27:45 -0400 |
commit | b33dd7874523af5c244fff3c45be1358815691e4 (patch) | |
tree | 589743681a94e8b48be0a8e7d034ed8bbc977091 /gcc/ada/gcc-interface | |
parent | 656c0212909bc91b1025aa12774d981adb531b4c (diff) | |
download | gcc-b33dd7874523af5c244fff3c45be1358815691e4.zip gcc-b33dd7874523af5c244fff3c45be1358815691e4.tar.gz gcc-b33dd7874523af5c244fff3c45be1358815691e4.tar.bz2 |
analyzer: fix uninit false positive with -ftrivial-auto-var-init= [PR106204]
-fanalyzer handles -ftrivial-auto-var-init= by special-casing
IFN_DEFERRED_INIT to be a no-op, so that e.g.:
len_2 = .DEFERRED_INIT (4, 2, &"len"[0]);
is treated as a no-op, so that len_2 is still uninitialized after the
stmt.
PR analyzer/106204 reports that -fanalyzer gives false positives from
-Wanalyzer-use-of-uninitialized-value on locals that have their address
taken, due to e.g.:
_1 = .DEFERRED_INIT (4, 2, &"len"[0]);
len = _1;
where -fanalyzer leaves _1 uninitialized, and then complains about
the assignment to "len".
Fixed thusly by suppressing the warning when assigning from such SSA
names.
gcc/analyzer/ChangeLog:
PR analyzer/106204
* region-model.cc (within_short_circuited_stmt_p): Move extraction
of assign_stmt to caller.
(due_to_ifn_deferred_init_p): New.
(region_model::check_for_poison): Move extraction of assign_stmt
from within_short_circuited_stmt_p to here. Share logic with
call to due_to_ifn_deferred_init_p.
gcc/testsuite/ChangeLog:
PR analyzer/106204
* gcc.dg/analyzer/torture/uninit-pr106204.c: New test.
* gcc.dg/analyzer/uninit-pr106204.c: New test.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Diffstat (limited to 'gcc/ada/gcc-interface')
0 files changed, 0 insertions, 0 deletions