[cfe-dev] one bit error
Ashish Gahlot via cfe-dev
cfe-dev at lists.llvm.org
Fri Jan 20 20:46:52 PST 2017
This is my first try on mailing list. Please correct if I am wrong.
On compiling this program using clang 3.9.1
#include <stdio.h>
#include <stdlib.h>
int main () {
int i,j;
static int x[4000][4000];
for (j = 0; j < 4000; j++) {
for (i = 0; i < 4000; i++) {
x[j][i] = i + j; }
}
}
got compiled to
mov dword ptr [rbp - 4], 0
mov dword ptr [rbp - 12], 0
.LBB0_1: # =>This Loop Header: Depth=1
cmp dword ptr [rbp - 12], 4000
jge .LBB0_8
mov dword ptr [rbp - 8], 0
.LBB0_3: # Parent Loop BB0_1 Depth=1
cmp dword ptr [rbp - 8], 4000
while gcc 7 gives this
mov DWORD PTR [rbp-8], 0
.L5:
cmp DWORD PTR [rbp-8], 3999
jg .L2
mov DWORD PTR [rbp-4], 0
.L4:
cmp DWORD PTR [rbp-4], 3999
jg .L3
I think it should be 3999.
--
Ashish Kumar Gahlot
III year, UG
Govt. Engg. College, Ajmer, India
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170121/b4ad9764/attachment.html>
More information about the cfe-dev
mailing list