olista01 abandoned this revision.
olista01 added a comment.
Ok, I'll abandon this patch and wait for Eric's.
I think the char* aliasing rule only works one way, i.e. any object can be
accessed through an lvalue of type char, but not the other way round (c++11,
3.10/10). I didn't know about the
EricWF added a comment.
@t.p.northover @olista01 A char array can legally alias any other type memory
AFAIK. Its perfectly legal to use a char array to provide raw memory. There
shouldn't be any undefined behavior here.
Repository:
rL LLVM
http://reviews.llvm.org/D14119
_
t.p.northover added a comment.
Oh, and I **think** it can probably be justified under C++, though I've not
quite joined up all the dots. The "object lifetime" rules seem to bless
declaring a char array dead and reusing its storage for another purpose. Since
heap_node has trivial initialization,
EricWF added a subscriber: EricWF.
EricWF added a comment.
This patch is incomplete and incorrect. The heap actually needs to be aligned
to a 16 byte boundary, and all pointers returned from it must also be 16 byte
aligned. I have a complete fix for this issue as http://reviews.llvm.org/D12669.
t.p.northover added a subscriber: t.p.northover.
t.p.northover added a comment.
Using alignas(heap_node) might be a little clearer and more semantically
correct here. Should be OK support-wise, libc++ is already using that for some
of its bits. Otherwise, good find!
Tim.
Repository:
rL LLVM