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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [20011126-2.c] - Blame information for rev 801

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

Line No. Rev Author Line
1 688 jeremybenn
/* Problem originally visible on ia64.
2
 
3
   There is a partial redundancy of "in + 1" that makes GCSE want to
4
   transform the final while loop to
5
 
6
     p = in + 1;
7
     tmp = p;
8
     ...
9
     goto start;
10
   top:
11
     tmp = tmp + 1;
12
   start:
13
     in = tmp;
14
     if (in < p) goto top;
15
 
16
   We miscalculate the number of loop iterations as (p - tmp) = 0
17
   instead of (p - in) = 1, which results in overflow in the doloop
18
   optimization.  */
19
 
20
static const char *
21
test (const char *in, char *out)
22
{
23
  while (1)
24
    {
25
      if (*in == 'a')
26
        {
27
          const char *p = in + 1;
28
          while (*p == 'x')
29
            ++p;
30
          if (*p == 'b')
31
            return p;
32
          while (in < p)
33
            *out++ = *in++;
34
        }
35
    }
36
}
37
 
38
int main ()
39
{
40
  char out[4];
41
  test ("aab", out);
42
  return 0;
43
}

powered by: WebSVN 2.1.0

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