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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [init/] [new17.C] - Blame information for rev 801

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

Line No. Rev Author Line
1 693 jeremybenn
// { dg-do compile }
2
// { dg-options "-O2 -fstrict-aliasing -fdump-tree-optimized" }
3
 
4
// Test that placement new does not introduce an unnecessary memory
5
// barrier.
6
// See PR 29286.
7
 
8
typedef __SIZE_TYPE__ size_t;
9
 
10
inline void* operator new(size_t, void* __p) throw() { return __p; }
11
 
12
template 
13
class Vector
14
{
15
public:
16
   Vector()
17
   {
18
     for (int i = 0; i < D; ++i)
19
        new (&x_m[i]) T();
20
   }
21
   T& operator[](int i) { return x_m[i]; }
22
 
23
private:
24
   T x_m[D];
25
};
26
 
27
void foo(Vector *m)
28
{
29
  Vector v;
30
  v[0] = 1.0;
31
  v[1] = 2.0;
32
  v[3] = 3.0;
33
  *m = v;
34
}
35
 
36
// { dg-final { scan-tree-dump-times "= 0\.0" 1 "optimized" } }
37
// { dg-final { cleanup-tree-dump "optimized" } }

powered by: WebSVN 2.1.0

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