https://issues.dlang.org/show_bug.cgi?id=16268
Lodovico Giaretta changed:
What|Removed |Added
CC||lodov...@giaretart.net
--- Comment #1 from Lodovico Giaretta ---
Looking at the generated assembly, it looks like, as a check x >= 0 is
performed before entering the loop, the compiler establishes that overflow will
not happen while condition i <= x holds (with x not negative).
Of course this is false for the edge case of x = typeof(x).max.
00 push rbp
01 movrbp,rsp
04 push rbx
05 push r12
07 movr12,rdi
0a xorebx,ebx ; i = 0
0c test r12b,r12b
0f js 21 ; if x < 0 skip for loop
11 movsx edi,bl
15 call ; call writeln
1a incbl ; i++
1c cmpbl,r12b
1f jle11 ; if i <= x continue for loop
21 popr12
23 poprbx
24 poprbp
25 ret
--