[all-commits] [llvm/llvm-project] b76219: [clang][Sema] Use correct array size for diagnostic
Bill Wendling via All-commits
all-commits at lists.llvm.org
Thu Oct 20 11:57:10 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: b76219b590208c1b539e614247f91481900bd7a1
https://github.com/llvm/llvm-project/commit/b76219b590208c1b539e614247f91481900bd7a1
Author: Bill Wendling <morbo at google.com>
Date: 2022-10-20 (Thu, 20 Oct 2022)
Changed paths:
M clang/docs/ReleaseNotes.rst
M clang/include/clang/Basic/DiagnosticSemaKinds.td
M clang/lib/Sema/SemaChecking.cpp
M clang/test/Sema/array-bounds-ptr-arith.c
M clang/test/Sema/integer-overflow.c
M clang/test/SemaCXX/array-bounds-ptr-arith.cpp
M clang/test/SemaCXX/array-bounds-strict-flex-arrays.cpp
M clang/test/SemaCXX/array-bounds.cpp
M clang/test/SemaCXX/integer-overflow.cpp
M clang/test/SemaObjC/flexible-array-bounds.m
Log Message:
-----------
[clang][Sema] Use correct array size for diagnostic
The diagnostic was confusing and reporting that an array contains far
more elements than it is defined to have, due to casting.
For example, this code:
double foo[4096];
((char*)foo)[sizeof(foo)];
warns that the "index 32768 is past the end of the array (which contains
32768 elements)."
Reviewed By: serge-sans-paille, aaron.ballman
Differential Revision: https://reviews.llvm.org/D135920
More information about the All-commits
mailing list