lib9: gcc-4.2 bug in sprint
This commit is contained in:
parent
b32d9d9c2e
commit
34167aa6b0
1 changed files with 4 additions and 1 deletions
|
|
@ -16,8 +16,11 @@ sprint(char *buf, char *fmt, ...)
|
||||||
/*
|
/*
|
||||||
* on PowerPC, the stack is near the top of memory, so
|
* on PowerPC, the stack is near the top of memory, so
|
||||||
* we must be sure not to overflow a 32-bit pointer.
|
* we must be sure not to overflow a 32-bit pointer.
|
||||||
|
*
|
||||||
|
* careful! gcc-4.2 assumes buf+len < buf can never be true and
|
||||||
|
* optimizes the test away. casting to uintptr works around this bug.
|
||||||
*/
|
*/
|
||||||
if(buf+len < buf)
|
if((uintptr)buf+len < (uintptr)buf)
|
||||||
len = -(uintptr)buf-1;
|
len = -(uintptr)buf-1;
|
||||||
|
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue