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 5void abort (void); 6static char * 7inttostr (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 22int 23main () 24{ 25 char buf[128], *p; 26 27 p = inttostr (-1, buf); 28 if (*p != '-') 29 abort (); 30 return 0; 31} 32