Hi, On 2012-10-14 23:44, Jakub Jelinek wrote: > On Mon, Oct 15, 2012 at 12:35:27AM +0300, Janne Blomqvist wrote: >> On Sat, Oct 13, 2012 at 4:26 PM, Tobias Schlüter >>> I'm putting forward two patches. One uses a C++ map to very concisely build >>> up and handle the ordered list of symbols. This has three problems: >>> 1) gfortran maintainers may not want C++isms (even though in this case >>> it's very localized, and in my opinion very transparent), and > > Even if you prefer a C++isms, why don't you go for "hash-table.h"? > std::map at least with the default allocator will just crash the compiler > if malloc returns NULL (remember that we build with -fno-exceptions), > while when you use hash-table.h (or hashtab.h) you get proper OOM diagnostics. The attached patch adds out-of-memory diagnostics for code using STL containers by using set_new_handler. Since the intended allocation size is not available to a new_handler, I had to forego a more detailed error message such as the one from xmalloc_failed(). fatal_error() and abort() don't give a meaningful location when the new_handler is called, so I chose to put together the error message manually as is done in xmalloc_failed(). I would have found it more appealing to have operator new call xmalloc() unless a custom allocator is given, but I don't think there's a standard way of doing this. Built and tested on the C and Fortran testsuites. Ok for trunk? Cheers, - Tobi