This revision was automatically updated to reflect the committed changes.
Closed by commit rGb2c3ae0b6f05: [Sema] Don't check bounds for function
pointer (authored by ArcsinX).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122748/new/
https://reviews.llvm.org/D122748
Files:
clang/lib/Sema/SemaChecking.cpp
clang/test/Sema/unbounded-array-bounds.c
Index: clang/test/Sema/unbounded-array-bounds.c
===================================================================
--- clang/test/Sema/unbounded-array-bounds.c
+++ clang/test/Sema/unbounded-array-bounds.c
@@ -80,3 +80,7 @@
(void *)0 + 0xdead000000000000UL;
// no array-bounds warning, and no crash
}
+
+void func() {
+ func + 0xdead000000000000UL; // no crash
+}
Index: clang/lib/Sema/SemaChecking.cpp
===================================================================
--- clang/lib/Sema/SemaChecking.cpp
+++ clang/lib/Sema/SemaChecking.cpp
@@ -15495,6 +15495,8 @@
ND = ME->getMemberDecl();
if (IsUnboundedArray) {
+ if (EffectiveType->isFunctionType())
+ return;
if (index.isUnsigned() || !index.isNegative()) {
const auto &ASTC = getASTContext();
unsigned AddrBits =
Index: clang/test/Sema/unbounded-array-bounds.c
===================================================================
--- clang/test/Sema/unbounded-array-bounds.c
+++ clang/test/Sema/unbounded-array-bounds.c
@@ -80,3 +80,7 @@
(void *)0 + 0xdead000000000000UL;
// no array-bounds warning, and no crash
}
+
+void func() {
+ func + 0xdead000000000000UL; // no crash
+}
Index: clang/lib/Sema/SemaChecking.cpp
===================================================================
--- clang/lib/Sema/SemaChecking.cpp
+++ clang/lib/Sema/SemaChecking.cpp
@@ -15495,6 +15495,8 @@
ND = ME->getMemberDecl();
if (IsUnboundedArray) {
+ if (EffectiveType->isFunctionType())
+ return;
if (index.isUnsigned() || !index.isNegative()) {
const auto &ASTC = getASTContext();
unsigned AddrBits =
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits