<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">If you take a look at the generated
code, you will see that clang uses <br>
cmp dword ptr [rbp - 12], 4000<br>
jge .LBB0_8<br>
which is equal (in C) to <br>
if (i >= 4000)<br>
<br>
while gcc generates<br>
cmp DWORD PTR [rbp-8], 3999<br>
jg .L2<br>
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
cite="mid:CAPww8bgcJD+aAjnx9KO3f-sEwqqL=nCpad1UQx=rPfYF64xkuQ@mail.gmail.com"
type="cite">
<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: # =>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: # 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="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>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
cfe-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a>
</pre>
</blockquote>
<p><br>
</p>
</body>
</html>