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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [tree-ssa/] [20040317-1.C] - Blame information for rev 693

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
/* { dg-do run } */
2
/* { dg-options "-O2" } */
3
 
4
/* Test provided by Brian Ryner in PR 14511.  The alias analyzer was
5
   not handling structures containing arrays properly.  In this case,
6
   the static cast was introducing two assignments of the form
7
 
8
          this_6->_vptr.IFoo = &_ZTV4IFoo[2];
9
          this_4->_vptr.IFoo = &_ZTV3Bar[2];
10
 
11
   which were not considered to alias each other because the alias
12
   analyzer was not computing a proper pointer to array elements.
13
   Another related bug was the type based alias analyzer not computing
14
   alias relations to _ZTV4IFoo and _ZTV3Bar.  Since those variables
15
   are read-only, it was disregarding alias information for them.
16
   So, the memory tags for the two 'this' variables were not being
17
   marked as aliased with these variables.  Resulting in the two
18
   assignments not aliasing each other.
19
 
20
   This was causing the optimizers to generate a call to the virtual
21
   method Foo() instead of the overloaded version.  */
22
 
23
struct IFoo
24
{
25
  virtual void Foo() = 0;
26
};
27
 
28
struct Bar : IFoo
29
{
30
  void Foo() { }
31
};
32
 
33
int main(int argc, char **argv)
34
{
35
  Bar* b = new Bar();
36
  static_cast(b)->Foo();
37
  return 0;
38
}

powered by: WebSVN 2.1.0

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