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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [init/] [new16.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 -fstrict-aliasing" }
3
 
4
// Test that we don't let TBAA reorder an assignment across a
5
// placement new.
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
void __attribute__((noinline)) bar() {}
13
 
14
long __attribute__((noinline)) foo(double *p, int n)
15
{
16
  long *f;
17
  for (int i=0; i
18
  {
19
    int *l = (int *)p;
20
    *l = 0;
21
    f = new (p) long;
22
    *f = -1;
23
  }
24
  bar ();
25
  return *f;
26
}
27
 
28
extern "C" void abort(void);
29
int main()
30
{
31
  union {
32
    int i;
33
    long l;
34
  } u;
35
  if (foo((double *)&u, 1) != -1)
36
    abort ();
37
  return 0;
38
}

powered by: WebSVN 2.1.0

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