2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / 20020503-1.c
blob6d45ca09af02071cbf0f7990f3df086607a69efb
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. */
5 void abort (void);
6 static char *
7 inttostr (long i, char buf[128])
9 unsigned long ui = i;
10 char *p = buf + 127;
11 *p = '\0';
12 if (i < 0)
13 ui = -ui;
15 *--p = '0' + ui % 10;
16 while ((ui /= 10) != 0);
17 if (i < 0)
18 *--p = '-';
19 return p;
22 int
23 main ()
25 char buf[128], *p;
27 p = inttostr (-1, buf);
28 if (*p != '-')
29 abort ();
30 return 0;