analyzer: fix direction of -Wanalyzer-out-of-bounds note [PR106626]
authorDavid Malcolm <dmalcolm@redhat.com>
Mon, 15 Aug 2022 18:47:03 +0000 (14:47 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Mon, 15 Aug 2022 18:47:03 +0000 (14:47 -0400)
commit23e8c0b0d99f585499baddda70af6a8b26f49bea
tree224cabaf171dc2940bf3e8f14fe8a6a7b9a3398c
parentca123e019bb92fd1d6909e8da7f53a4f45922526
analyzer: fix direction of -Wanalyzer-out-of-bounds note [PR106626]

Fix a read/write typo.

Also, add more test coverage of -Wanalyzer-out-of-bounds to help
establish a baseline for experiments on tweaking the wording of
the warning (PR analyzer/106626).

gcc/analyzer/ChangeLog:
PR analyzer/106626
* region-model.cc (buffer_overread::emit): Fix copy&paste error in
direction of the access in the note.

gcc/testsuite/ChangeLog:
PR analyzer/106626
* gcc.dg/analyzer/out-of-bounds-read-char-arr.c: New test.
* gcc.dg/analyzer/out-of-bounds-read-int-arr.c: New test.
* gcc.dg/analyzer/out-of-bounds-write-char-arr.c: New test.
* gcc.dg/analyzer/out-of-bounds-write-int-arr.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/analyzer/region-model.cc
gcc/testsuite/gcc.dg/analyzer/out-of-bounds-read-char-arr.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/analyzer/out-of-bounds-read-int-arr.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/analyzer/out-of-bounds-write-char-arr.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/analyzer/out-of-bounds-write-int-arr.c [new file with mode: 0644]