URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Go to most recent revision |
Only display areas with differences |
Details |
Blame |
View Log
Rev 149 |
Rev 154 |
// { dg-do run }
|
// { dg-do run }
|
|
|
// Copyright (C) 2004 Free Software Foundation, Inc.
|
// Copyright (C) 2004 Free Software Foundation, Inc.
|
// Contributed by Nathan Sidwell 8 Dec 2004
|
// Contributed by Nathan Sidwell 8 Dec 2004
|
|
|
// PR 16681 too much memory used
|
// PR 16681 too much memory used
|
// Origin: Matt LaFary
|
// Origin: Matt LaFary
|
|
|
struct foo {
|
struct foo {
|
unsigned char buffer[4111222];
|
unsigned char buffer[4111222];
|
foo() ;
|
foo() ;
|
bool check () const;
|
bool check () const;
|
};
|
};
|
|
|
foo::foo ()
|
foo::foo ()
|
: buffer()
|
: buffer()
|
{}
|
{}
|
|
|
bool foo::check () const
|
bool foo::check () const
|
{
|
{
|
for (unsigned ix = sizeof (buffer); ix--;)
|
for (unsigned ix = sizeof (buffer); ix--;)
|
if (buffer[ix])
|
if (buffer[ix])
|
return false;
|
return false;
|
return true;
|
return true;
|
}
|
}
|
|
|
void *operator new (__SIZE_TYPE__ size, void *p)
|
void *operator new (__SIZE_TYPE__ size, void *p)
|
{
|
{
|
return p;
|
return p;
|
}
|
}
|
|
|
char heap[5000000];
|
char heap[5000000];
|
|
|
int main ()
|
int main ()
|
{
|
{
|
for (unsigned ix = sizeof (heap); ix--;)
|
for (unsigned ix = sizeof (heap); ix--;)
|
heap[ix] = ix;
|
heap[ix] = ix;
|
|
|
foo *f = new (heap) foo ();
|
foo *f = new (heap) foo ();
|
|
|
if (!f->check ())
|
if (!f->check ())
|
return 1;
|
return 1;
|
return 0;
|
return 0;
|
}
|
}
|
|
|
|
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.