Displaying 2 results from an estimated 2 matches for "misaligned_int".
2016 Jan 18
3
[cfe-dev] RFC: Enforcing pointer type alignment in Clang
Hi John,
On 15 Jan 2016, at 08:14, John McCall via llvm-dev <llvm-dev at lists.llvm.org> wrote:
>
> The question at hand is whether we should require the user to write this:
> misaligned_A_B *p = &a.b;
> instead of, say:
> A::B *p = &a.b;
> int x = *(misaligned_int*) &p->n;
> because we want to reserve the right to invoke undefined behavior and propagate our “knowledge" that p is 4-byte-aligned to “improve” the 1-byte-aligned access on the next line.
>
> My contention is that this is a clean and elegantly simple formal model that is disa...
2016 Jan 15
2
[cfe-dev] RFC: Enforcing pointer type alignment in Clang
(Sorry for the duplicate mail, Richard, I accidentally sent a copy only to
you before.)
On Thu, Jan 14, 2016 at 10:26 PM, Richard Smith via cfe-dev <
cfe-dev at lists.llvm.org> wrote:
> [1]: That's not completely true, as it's possible to create an object
> that is underaligned for its type:
>
> struct __attribute__((packed)) A {
> char k;
> struct B { int n;