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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [20050502-1.c] - Blame information for rev 825

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

Line No. Rev Author Line
1 149 jeremybenn
/* PR rtl-optimization/21330 */
2
 
3
extern void abort (void);
4
extern int strcmp (const char *, const char *);
5
 
6
int
7
__attribute__((noinline))
8
bar (const char **x)
9
{
10
  return *(*x)++;
11
}
12
 
13
int
14
__attribute__((noinline))
15
baz (int c)
16
{
17
  return c != '@';
18
}
19
 
20
void
21
__attribute__((noinline))
22
foo (const char **w, char *x, _Bool y, _Bool z)
23
{
24
  char c = bar (w);
25
  int i = 0;
26
 
27
  while (1)
28
    {
29
      x[i++] = c;
30
      c = bar (w);
31
      if (y && c == '\'')
32
        break;
33
      if (z && c == '\"')
34
        break;
35
      if (!y && !z && !baz (c))
36
        break;
37
    }
38
   x[i] = 0;
39
}
40
 
41
int
42
main (void)
43
{
44
  char buf[64];
45
  const char *p;
46
  p = "abcde'fgh";
47
  foo (&p, buf, 1, 0);
48
  if (strcmp (p, "fgh") != 0 || strcmp (buf, "abcde") != 0)
49
    abort ();
50
  p = "ABCDEFG\"HI";
51
  foo (&p, buf, 0, 1);
52
  if (strcmp (p, "HI") != 0 || strcmp (buf, "ABCDEFG") != 0)
53
    abort ();
54
  p = "abcd\"e'fgh";
55
  foo (&p, buf, 1, 1);
56
  if (strcmp (p, "e'fgh") != 0 || strcmp (buf, "abcd") != 0)
57
    abort ();
58
  p = "ABCDEF'G\"HI";
59
  foo (&p, buf, 1, 1);
60
  if (strcmp (p, "G\"HI") != 0 || strcmp (buf, "ABCDEF") != 0)
61
    abort ();
62
  p = "abcdef@gh";
63
  foo (&p, buf, 0, 0);
64
  if (strcmp (p, "gh") != 0 || strcmp (buf, "abcdef") != 0)
65
    abort ();
66
  return 0;
67
}

powered by: WebSVN 2.1.0

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