OSDN Git Service
(root)
/
pf3gnuchains
/
gcc-fork.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
PR middle-end/35456
[pf3gnuchains/gcc-fork.git]
/
gcc
/
testsuite
/
gcc.c-torture
/
execute
/
20020503-1.c
1
/* PR 6534 */
2
/* GCSE unified the two i<0 tests, but if-conversion to ui=abs(i)
3
insertted the code at the wrong place corrupting the i<0 test. */
4
5
void abort (void);
6
static char *
7
inttostr (long i, char buf[128])
8
{
9
unsigned long ui = i;
10
char *p = buf + 127;
11
*p = '\0';
12
if (i < 0)
13
ui = -ui;
14
do
15
*--p = '0' + ui % 10;
16
while ((ui /= 10) != 0);
17
if (i < 0)
18
*--p = '-';
19
return p;
20
}
21
22
int
23
main ()
24
{
25
char buf[128], *p;
26
27
p = inttostr (-1, buf);
28
if (*p != '-')
29
abort ();
30
return 0;
31
}