Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/gcc.c-torture/execute/20020503-1.c @ 158:494b0b89df80 default tip
...
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 25 May 2020 18:13:55 +0900 |
parents | 04ced10e8804 |
children |
line wrap: on
line source
/* PR 6534 */ /* GCSE unified the two i<0 tests, but if-conversion to ui=abs(i) insertted the code at the wrong place corrupting the i<0 test. */ void abort (void); static char * inttostr (long i, char buf[128]) { unsigned long ui = i; char *p = buf + 127; *p = '\0'; if (i < 0) ui = -ui; do *--p = '0' + ui % 10; while ((ui /= 10) != 0); if (i < 0) *--p = '-'; return p; } int main () { char buf[128], *p; p = inttostr (-1, buf); if (*p != '-') abort (); return 0; }