[PATCH] D16843: [Sema] Fix bug in TypeLocBuilder::pushImpl

Akira Hatanaka via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 2 22:54:29 PST 2016


ahatanak created this revision.
ahatanak added reviewers: doug.gregor, rjmccall, vsk.
ahatanak added a subscriber: cfe-commits.

This patch fixes a bug in the code between line 117-126 of TypeLocBuilder.cpp which was causing the assert in line 132.

The bug manifests itself when an element of size=4 and alignment=4 is inserted first and then an element of size=28 and alignment=8 is inserted next. The code inserts a 4-byte padding at the tail of the first element before the second element is inserted, but that is incorrect and unnecessary since the second element is correctly aligned without any paddings (it can start at Index=32 because it's size is 28-bytes).

http://reviews.llvm.org/D16843

Files:
  lib/Sema/TypeLocBuilder.cpp
  lib/Sema/TypeLocBuilder.h
  test/SemaObjCXX/typeloc-data-alignment.mm

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16843.46746.patch
Type: text/x-patch
Size: 5301 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160203/77ee2f85/attachment-0001.bin>


More information about the cfe-commits mailing list