[llvm-bugs] [Bug 26741] New: __builtin_object_size is not consistently conservative with C++ inheritance
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Feb 25 09:56:11 PST 2016
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: unassignedclangbugs at nondot.org
Reporter: bob.wilson at apple.com
CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160225/7a0a0689/attachment.html>
More information about the llvm-bugs
mailing list