[llvm-bugs] [Bug 26741] __builtin_object_size is not consistently conservative with C++ inheritance

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Mar 18 11:54:48 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=26741

George Burgess <george.burgess.iv at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #3 from George Burgess <george.burgess.iv at gmail.com> ---
So, I abandoned the revision for a few reasons:
- Having this detection would reduce our accuracy
- GCC 4.8 acts just as we do, and there hasn't seemed to be a problem with that
yet
- There's a reasonably straightforward workaround if you do encounter this
behavior [1] (...and I doubt it would be encountered often)

If you strongly disagree, feel free to reopen this bug+code review. :)

[1] -
void test3() {
  struct A { int i; char buf[1]; };
  struct B : A {};
  struct C { int i; B bs[1]; } *c;

  // Delegates to @llvm.objectsize on trunk, because you've casted to an A*.
  gi = __builtin_object_size(&((A*)&c->bs)->buf[0], 1);
}

-- 
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/20160318/a4e76c94/attachment.html>


More information about the llvm-bugs mailing list