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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.old-deja/] [g++.jason/] [new.C] - Blame information for rev 338

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 305 jeremybenn
// { dg-do assemble  }
2
// Bug: new doesn't make sure that the count is an integral value.
3
 
4
#include 
5
extern "C" int printf (const char *, ...);
6
extern "C" void *malloc (size_t);
7
size_t s;
8
 
9
void * operator new (size_t siz) throw (std::bad_alloc) {
10
  if (s == 0)
11
    s = siz;
12
  else
13
    s = (s != siz);
14
  return malloc (siz);
15
}
16
 
17
int main()
18
{
19
  s = 0;
20
 
21
  float f = 3;
22
  int* b1 = new int[(int)f];
23
  int* b2 = new int[f];         // { dg-error "" } new requires integral size
24
 
25
  return s;
26
}

powered by: WebSVN 2.1.0

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