ArcsinX updated this revision to Diff 419242. ArcsinX added a comment. Check for function type only if IsUnboundedArray is true
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 @@ -15468,6 +15468,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 @@ -15468,6 +15468,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 cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits