This is an archive of the discontinued LLVM Phabricator instance.

[ADT] Fix support for over-aligned pointers in PointerSumType
Needs ReviewPublic

Authored by eush on Oct 30 2018, 5:08 PM.

Details

Reviewers
chandlerc
rsmith
Summary

This fixes compilation error when the tag of PointerSumType is wider than an
int, which is the case when the payload has too many low bits available.

E.g. on x86-64 when the payload is 8 bit wide and the tag is 56 bit wide, GCC
reports the following error message:

include/llvm/ADT/PointerSumType.h:252:37: error: right operand of shift expression ‘(1 << 56)’ is >= than the precision of the left operand [-fpermissive]
     static_assert(MemberT::Tag < (1 << NumTagBits),
                                  ~~~^~~~~~~~~~~~~~

Diff Detail

Event Timeline

eush created this revision.Oct 30 2018, 5:08 PM
eush updated this revision to Diff 171841.Oct 30 2018, 5:13 PM

Removed FIXME.

eush added inline comments.Oct 30 2018, 5:16 PM
unittests/ADT/PointerSumTypeTest.cpp
36

This is formatted by clang-format and the indentation is a bit weird. A using declaration would be indented more nicely, but I sticked to typedef for consistency.