Debian Codegraph @

gcc/testsuite/gcc.c-torture/execute/20021120-3.c

raw
1 /* Test whether a partly call-clobbered register will be moved over a call.
2 Although the original test case didn't use any GNUisms, it proved
3 difficult to reduce without the named register extension. */
4
5 void abort (void);
6 void exit (int);
7
8 #if __SH64__ == 32
9 #define LOC asm ("r10")
10 #else
11 #define LOC
12 #endif
13
14 unsigned int foo (char *c, unsigned int x, unsigned int y)
15 {
16 register unsigned int z LOC;
17
18 __builtin_sprintf (c, "%d", x / y);
19 z = x + 1;
20 return z / (y + 1);
21 }
22
23 int main ()
24 {
25 char c[16];
26
27 if (foo (c, ~1U, 4) != (~0U / 5))
28 abort ();
29 exit (0);
30 }