From 23e8c0b0d99f585499baddda70af6a8b26f49bea Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Mon, 15 Aug 2022 14:47:03 -0400 Subject: 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 --- gcc/analyzer/region-model.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/analyzer') diff --git a/gcc/analyzer/region-model.cc b/gcc/analyzer/region-model.cc index a58904c..b05b709 100644 --- a/gcc/analyzer/region-model.cc +++ b/gcc/analyzer/region-model.cc @@ -1447,11 +1447,11 @@ public: print_dec (m_out_of_bounds_range.m_size_in_bytes, num_bytes_past_buf, UNSIGNED); if (m_diag_arg) - inform (rich_loc->get_loc (), "write is %s bytes past the end" + inform (rich_loc->get_loc (), "read is %s bytes past the end" " of %qE", num_bytes_past_buf, m_diag_arg); else - inform (rich_loc->get_loc (), "write is %s bytes past the end" + inform (rich_loc->get_loc (), "read is %s bytes past the end" "of the region", num_bytes_past_buf); } -- cgit v1.1