Message180473
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. |
|
Date |
User |
Action |
Args |
2013-01-23 16:56:35 | Nickolai.Zeldovich | set | recipients:
+ Nickolai.Zeldovich, mark.dickinson, ezio.melotti, mrabarnett, serhiy.storchaka |
2013-01-23 16:56:35 | Nickolai.Zeldovich | set | messageid: <1358960195.58.0.175127037544.issue17016@psf.upfronthosting.co.za> |
2013-01-23 16:56:35 | Nickolai.Zeldovich | link | issue17016 messages |
2013-01-23 16:56:35 | Nickolai.Zeldovich | create | |
|