[Bug libstdc++/64535] Emergency buffer for exception allocation too small

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jan 8 11:57:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64535

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Is the following required to work?

#include <exception>
#include <new>
#include <sys/resource.h>

struct large
{
  char s[1024*1024*1024];
};

int main()
{
  rlimit lim;
  lim.rlim_cur = 1024*1024*1024;
  lim.rlim_max = 1024*1024*1024;
  setrlimit (RLIMIT_AS, &lim);
  try {
      throw large ();
  } catch (large&) {
  } catch (std::bad_alloc) {
  }
}

I get

> ./a.out 
terminate called without an active exception
Aborted



More information about the Gcc-bugs mailing list