diff options
author | David Malcolm <dmalcolm@redhat.com> | 2020-02-12 10:56:28 -0500 |
---|---|---|
committer | David Malcolm <dmalcolm@redhat.com> | 2020-02-17 02:15:00 -0500 |
commit | 0993ad65cc4e462223e9337d9b2d3b82a887c6c8 (patch) | |
tree | 58de32ad6c3843318a600fa639a1450fd5bd1317 /libphobos/src/std/format.d | |
parent | 670987874d2aa043a454e112291931e32f4ca8cc (diff) | |
download | gcc-0993ad65cc4e462223e9337d9b2d3b82a887c6c8.zip gcc-0993ad65cc4e462223e9337d9b2d3b82a887c6c8.tar.gz gcc-0993ad65cc4e462223e9337d9b2d3b82a887c6c8.tar.bz2 |
analyzer: fix wording for assignment from NULL
This patch improves the wording of the state-transition event (1) in
the -Wanalyzer-null-dereference diagnostic for:
void test (void)
{
int *p = NULL;
*p = 1;
}
taking the path description from:
‘test’: events 1-2
|
| 5 | int *p = NULL;
| | ^
| | |
| | (1) assuming ‘p’ is NULL
| 6 | *p = 1;
| | ~~~~~~
| | |
| | (2) dereference of NULL ‘p’
|
to:
‘test’: events 1-2
|
| 5 | int *p = NULL;
| | ^
| | |
| | (1) ‘p’ is NULL
| 6 | *p = 1;
| | ~~~~~~
| | |
| | (2) dereference of NULL ‘p’
|
since the "assuming" at (1) only makes sense for state transitions
due to comparisons, not for assignments.
gcc/analyzer/ChangeLog:
* sm-malloc.cc (malloc_diagnostic::describe_state_change): For
transition to the "null" state, only say "assuming" when
transitioning from the "unchecked" state.
gcc/testsuite/ChangeLog:
* gcc.dg/analyzer/malloc-1.c (test_48): New.
Diffstat (limited to 'libphobos/src/std/format.d')
0 files changed, 0 insertions, 0 deletions