<div dir="ltr">sorry about that, I missed that detail. Thanks for correcting.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jan 21, 2017 at 10:59 AM, Alexey Sidorin <span dir="ltr"><<a href="mailto:alexey.v.sidorin@ya.ru" target="_blank">alexey.v.sidorin@ya.ru</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div class="m_-3947773179363343664moz-cite-prefix">If you take a look at the generated
code, you will see that clang uses <br><span class="">
cmp dword ptr [rbp - 12], 4000<br>
jge .LBB0_8<br></span>
which is equal (in C) to <br>
if (i >= 4000)<br>
<br>
while gcc generates<span class=""><br>
cmp DWORD PTR [rbp-8], 3999<br>
jg .L2<br></span>
which is equal to<br>
if (i > 3999)<br>
<br>
I don't see any difference here. Why do you think this is an
issue?<br>
<br>
<br>
21.01.2017 07:46, Ashish Gahlot via cfe-dev пишет:<br>
</div>
<blockquote type="cite"><div><div class="h5">
<div dir="ltr">
<div>
<div>This is my first try on mailing list. Please correct if I
am wrong.<br>
</div>
On compiling this program using clang 3.9.1<br>
<br>
#include <stdio.h><br>
#include <stdlib.h><br>
<br>
int main () {<br>
int i,j;<br>
static int x[4000][4000];<br>
for (j = 0; j < 4000; j++) {<br>
for (i = 0; i < 4000; i++) {<br>
x[j][i] = i + j; }<br>
}<br>
}<br>
</div>
<div>got compiled to <br>
<br>
mov dword ptr [rbp - 4], 0<br>
mov dword ptr [rbp - 12], 0<br>
.LBB0_1: <wbr> # =>This Loop
Header: Depth=1<br>
cmp dword ptr [rbp - 12], 4000<br>
jge .LBB0_8<br>
mov dword ptr [rbp - 8], 0<br>
.LBB0_3: <wbr> # Parent Loop BB0_1
Depth=1<br>
cmp dword ptr [rbp - 8], 4000<br>
<br>
</div>
<div>while gcc 7 gives this <br>
<br>
mov DWORD PTR [rbp-8], 0<br>
.L5:<br>
cmp DWORD PTR [rbp-8], 3999<br>
jg .L2<br>
mov DWORD PTR [rbp-4], 0<br>
.L4:<br>
cmp DWORD PTR [rbp-4], 3999<br>
jg .L3<br>
<br>
</div>
<div>I think it should be 3999.<br>
</div>
<div>
<div>
<div><br>
-- <br>
<div class="m_-3947773179363343664gmail_signature">
<div dir="ltr">
<div>Ashish Kumar Gahlot</div>
<div>III year, UG</div>
<div>Govt. Engg. College, Ajmer, India</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset class="m_-3947773179363343664mimeAttachmentHeader"></fieldset>
<br>
</div></div><pre>______________________________<wbr>_________________
cfe-dev mailing list
<a class="m_-3947773179363343664moz-txt-link-abbreviated" href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>
<a class="m_-3947773179363343664moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a>
</pre>
</blockquote>
<p><br>
</p>
</div>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Ashish Kumar Gahlot</div><div>III year, UG</div><div>Govt. Engg. College, Ajmer, India</div></div></div>
</div>