[PATCH] ADT: Remove misaligned pointeres from DenseMapInfo

David Majnemer david.majnemer at gmail.com
Sun Sep 21 14:41:43 PDT 2014


C11 6.3.2.3p7:

A pointer to an object or incomplete type may be converted to a pointer to
a different object or incomplete type. If the resulting pointer is not
correctly aligned for the referenced type, the behavior is undefined.


On Sun, Sep 21, 2014 at 2:17 PM, Duncan P. N. Exon Smith <
dexonsmith at apple.com> wrote:

>
> > On 2014 Sep 21, at 05:25, David Majnemer <david.majnemer at gmail.com>
> wrote:
> >
> > C++ requires that pointers point to sufficiently well aligned addresses.
>
> I thought this only applied to allocated memory.
>
> > getEmptyKey() and getTombstoneKey() would cast -1 and -2 to arbitrary
> > pointer types which would violate this requirement.
>
> What part of the standard labels this undefined behaviour?  I can't
> find it.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140921/8425bd6e/attachment.html>


More information about the llvm-commits mailing list