<br><br><div class="gmail_quote">On Fri, Aug 21, 2009 at 12:33 PM, Eli Friedman <span dir="ltr"><<a href="mailto:eli.friedman@gmail.com">eli.friedman@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">On Fri, Aug 21, 2009 at 2:02 AM, Artur Pietrek<<a href="mailto:pietreka@gmail.com">pietreka@gmail.com</a>> wrote:<br>
> Hi All,<br>
> Since few days I observe weird change.<br>
> Consider the following C code<br>
><br>
> char array[] = "0123456789";<br>
> extern int test(char arr[], int size);<br>
><br>
> int main(void) {<br>
>   return test(array-1, sizeof(array)-1);<br>
> }<br>
><br>
> using clang frontend i get this:<br>
><br>
> %call = call i32 @test(i8* getelementptr inbounds ([11 x i8]* @array, i32 0,<br>
> i32 -1), i32 10) ; <i32> [#uses=1]<br>
><br>
> and using LLVM-GCC this:<br>
> %1 = call i32 @test(i8* getelementptr ([11 x i8]* @array, i32 1561806289,<br>
> i32 4), i32 10) nounwind ; <i32> [#uses=1]<br>
><br>
> Should the second getelementptr look like this? Is it correct or a bug?<br>
<br>
</div>Indexing out of an array is undefined behavior per C99, but that<br>
particular result does look strange...<br>
<div class="im"></div></blockquote><div><br>So it isn't a bug? <br>It's weird that it simply started to happen few days ago and only with llvm-gcc. <br><br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im"><br>
> Since that change there's a problem in MSIL backend - it simply triggers<br>
> pointer overflow assertion.<br>
<br>
</div>Sorry, I don't know anything about the MSIL backend.<br>
<font color="#888888"><br>
-Eli<br>
</font></blockquote></div><br>