OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc2/] [gcc/] [testsuite/] [gcc.dg/] [tree-ssa/] [pr22236.c] - Blame information for rev 384

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* { dg-do run } */
2
/* { dg-options "-O1 -fno-tree-vrp -fwrapv" } */
3
 
4
/* PR tree-optimization/22236
5
 
6
    Avoid conversion of (signed char) {(uchar)1, +, (uchar)1}_x when
7
    it is not possible to prove that the scev does not wrap.
8
 
9
    In this PR, a sequence 1, 2, ..., 255 has to be converted to
10
    signed char, but this would wrap: 1, 2, ..., 127, -128, ...  The
11
    result should not be a linear scev {(schar)1, +, (schar)1}_x.
12
    The conversion should be kept: (schar) {(uchar)1, +, (uchar)1}_x.
13
 */
14
 
15
void abort(void);
16
 
17
static inline void
18
foo (signed char a)
19
{
20
  int b = a - 0x7F;
21
  if (b > 1)
22
    abort();
23
}
24
 
25
int main()
26
{
27
  unsigned char b;
28
  for(b = 0; b < 0xFF; b++)
29
    foo (b);
30
 
31
  return 0;
32
}
33
 

powered by: WebSVN 2.1.0

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