Displaying 3 results from an estimated 3 matches for "d8d7aa61".
2008 Mar 12
3
[LLVMdev] Language lawyer question
...));
>> X = Y;
>> for (i=0, p=(char *)&X; i<sizeof(struct x); i++, p++)
>> if (*p != 22)
>> abort();
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080311/d8d7aa61/attachment.html>
2008 Mar 12
0
[LLVMdev] Language lawyer question
I thought pointer referencing like this was only valid for arrays. I
could be wrong, but it might be that looping over the struct like that
is invalid, making it undefined behavior (and then the hole doesn't
matter because there is no valid way to access it). That said, I've
definitely
seen a lot of code that uses pointers to reference struct contents.
On Mar 11, 2008, at 10:42
2008 Mar 12
9
[LLVMdev] Language lawyer question
Looking through the gcc testsuite turned up an interesting edge case.
Let's assume our target leaves a hole for alignment in struct x, as do
x86 and powerpc. Do you think the following code can validly abort?
struct x { char c; short s; };
int i; char *p;
memset(&X, 0, sizeof(struct x));
memset(&Y, 22, sizeof(struct x));
X = Y;
for (i=0, p=(char *)&X;