Merge from mainline
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / pr19606.c
blobd1e836fa028a46ecbda2a195dfc467bb31601bdf
1 /* PR c/19606
2 The C front end used to shorten the type of a division to a type
3 that does not preserve the semantics of the original computation.
4 Make sure that won't happen. */
6 signed char a = -4;
8 int
9 foo (void)
11 return ((unsigned int) (signed int) a) / 2LL;
14 int
15 bar (void)
17 return ((unsigned int) (signed int) a) % 5LL;
20 int
21 main (void)
23 int r;
25 r = foo ();
26 if (r != ((unsigned int) (signed int) (signed char) -4) / 2LL)
27 abort ();
29 r = bar ();
30 if (r != ((unsigned int) (signed int) (signed char) -4) % 5LL)
31 abort ();
33 exit (0);