Nickolai Zeldovich added the comment:
Lines 2777 and 3111 do indeed look suspect, because gcc can compile (ptr +
offset < ptr) into (offset < 0):
nickolai@sahara:/tmp$ cat x.c
void bar();
void
foo(char* ptr, int offset)
{
if (ptr + offset < ptr)
bar();
}
nickolai@sahara:/tmp$ gcc x.c -S -o - -O2
...
foo:
.LFB0:
.cfi_startproc
testl %esi, %esi
js .L4
rep
ret
.p2align 4,,10
.p2align 3
.L4:
xorl %eax, %eax
jmp bar
.cfi_endproc
...
nickolai@sahara:/tmp$
Lines 658, 678, 1000, 1084 are potentially problematic -- I don't know of
current compilers that will do something unexpected, but it might be worth
rewriting the code to avoid undefined behavior anyway.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue17016>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com