<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">I think what Daniel meant here is that you can have<div><br><div> struct S { int a[2]; int b[2];}g;</div><div> char *ptr = &g.a[1];</div><div> ++ptr;</div><div> *ptr = …// you are now accessing S.b (without knowing it by just looking at the type of access "char *")</div><div><br></div><div>This is all defined behavior in C and a TBAA system would have to make sure it correctly says that ptr might alias &structS.a/b. But this is fine with my envisioned enhanced TBAA because *ptr is an access through a char pointer and an access through a char pointer aliases with any access in a TBAA system for C.</div><div><br></div><div>(Although I have to admit, I have not tried to break it for long, so I don't feel comfortable to say I know it is gonna work but only I believe - maybe Daniel knows it won't work - he has way more experience working on Pointer Analysis than I have ;)</div><div><br></div><div><br><div><div>On Feb 16, 2013, at 6:57 AM, Renato Golin <<a href="mailto:renato.golin@linaro.org">renato.golin@linaro.org</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">On 16 February 2013 00:38, Daniel Berlin <span dir="ltr"><<a href="mailto:dberlin@dberlin.org" target="_blank">dberlin@dberlin.org</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><span style="color:rgb(34,34,34)">you fall into the "otherwise, the behavior is undefined".</span><br>
</div>
<br>
It would be explicitly valid to convert it to char *, and read it up<br>
to and through B, but not using the array access operator.<br></blockquote><div><br></div><div style="">Unfortunately, "undefined behaviour" is valid C. It means you'll have to compile that without error (possibly a warning), but you're allowed to do whatever you want.</div>
<div style=""><br></div><div style="">Clang sometimes remove accesses if they're going to go outside the boundaries (if it can tell) as optimization, as we seen in the Livermore Loops example. GCC vectorizes a loop when the only aliasing possible is with out-of-bounds access (thus getting different results). All that falls into the category of "user error", so both Clang and GCC won't change their behaviour on optimized builds.</div>
<div style=""><br></div><div style="">cheers,</div><div style="">--renato</div></div></div></div>
</blockquote></div><br></div></div></body></html>