https://llvm.org/bugs/show_bug.cgi?id=26741
Bug ID: 26741 Summary: __builtin_object_size is not consistently conservative with C++ inheritance Product: clang Version: trunk Hardware: Macintosh OS: All Status: NEW Severity: normal Priority: P Component: Frontend Assignee: unassignedclangb...@nondot.org Reporter: bob.wil...@apple.com CC: llvm-bugs@lists.llvm.org Classification: Unclassified Created attachment 15946 --> https://llvm.org/bugs/attachment.cgi?id=15946&action=edit patch for the object-size.cpp test Clang r250488 added code to make __builtin_object_size more conservative when dealing with an array of size 0 or 1 as the last member in a struct to support the "writing off the end" idiom. The CodeGen/object-size.cpp test was added along with that patch. I noticed that if I change the test2() function in that test to use a buffer size of 1, then it does not report the object size in the same conservative way. It didn't look like that was intentional. The isDesignatorAtObjectEnd() function in lib/AST/ExprConstant.cpp is not handling the case with C++ inheritance and so it gives up. The catch is that "giving up" in this case does not lead to the conservative behavior. The attached patch to the test shows what I would expect to happen. -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs