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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [g++.dg/] [init/] [new26.C] - Blame information for rev 315

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

Line No. Rev Author Line
1 301 jeremybenn
// PR c++/33407
2
// { dg-do run }
3
// { dg-options "-O2 -fstrict-aliasing" }
4
 
5
extern "C" void * malloc(__SIZE_TYPE__);
6
extern "C" void abort(void);
7
 
8
void *p;
9
void __attribute__((noinline)) init(void)
10
{
11
  p = malloc(4);
12
}
13
 
14
inline void *operator new(__SIZE_TYPE__)
15
{
16
  return p;
17
}
18
 
19
inline void operator delete (void*) {}
20
 
21
int * __attribute__((noinline)) doit(int n)
22
{
23
  float *q;
24
  int *r;
25
 
26
  for (int i=0; i
27
  {
28
    q = new float;
29
    *q = 1.0;
30
    delete q;
31
    r = new int;
32
    *r = 1;
33
  }
34
 
35
  return r;
36
}
37
 
38
int main()
39
{
40
  init();
41
  if (*doit(1) != 1)
42
    abort();
43
  return 0;
44
}

powered by: WebSVN 2.1.0

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