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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.dg/] [opt/] [alias3.C] - Blame information for rev 154

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

Line No. Rev Author Line
1 149 jeremybenn
// { dg-options "-O2" }
2
 
3
// Contributed by Nathan Sidwell 22 Dec 2003 
4
// Origin: rsandifo@redhat.com
5
 
6
// PR c++/13387. Alias sets were incorrect
7
 
8
struct C {
9
  C(short *p = 0, int i = 0) : ptr (p), index (i) {}
10
  short operator*() { return ptr[index]; }
11
  short *ptr;
12
  int index;
13
};
14
 
15
C f1 (C) __attribute__ ((noinline));
16
C f1 (C x)
17
{
18
  return x;
19
}
20
 
21
void f2 (short)__attribute__ ((noinline));;
22
short s;
23
 
24
void f2 (short s_)
25
{
26
  s = s_;
27
}
28
 
29
C g (C x)__attribute__ ((noinline));
30
C g (C x)
31
{
32
  x = f1 (x);
33
  f2 (*x);
34
  return x;
35
}
36
 
37
int main ()
38
{
39
  short p[2] = { 0x1234, 0x5678 };
40
  C x (p, 1);
41
 
42
  g (x);
43
 
44
  return s != p[1];
45
}

powered by: WebSVN 2.1.0

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