OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [pr19606.c] - Blame information for rev 774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 688 jeremybenn
/* 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.  */
5
 
6
signed char a = -4;
7
 
8
int
9
foo (void)
10
{
11
  return ((unsigned int) (signed int) a) / 2LL;
12
}
13
 
14
int
15
bar (void)
16
{
17
  return ((unsigned int) (signed int) a) % 5LL;
18
}
19
 
20
int
21
main (void)
22
{
23
  int r;
24
 
25
  r = foo ();
26
  if (r != ((unsigned int) (signed int) (signed char) -4) / 2LL)
27
    abort ();
28
 
29
  r = bar ();
30
  if (r != ((unsigned int) (signed int) (signed char) -4) % 5LL)
31
    abort ();
32
 
33
  exit (0);
34
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.