Why are GCC Internals not Specification Driven ?

2016-12-17 Thread Seima Rao
Hi, For regular users of gcc who want to delve into the insides(guts) of the compiler, it is disappointing that there exist no complete specification of internals in a phase order manner. Precisely, stuffs like GENERIC, GIMPLE, RTL, gas(inline assembly), GCC extensions interna

Re: using C++ STL containers in GCC/gfortran source code

2016-12-17 Thread Pedro Alves
On 12/17/2016 05:24 PM, Jakub Jelinek wrote: > On Sat, Dec 17, 2016 at 11:17:25AM -0500, Frank Ch. Eigler wrote: >> Pedro Alves writes: >> >>> [...] >>> malloc will fail, new will throw bad_alloc, and GCC will abort and >>> maybe generate a core dump, instead of gracefully printing >>> something l

Re: using C++ STL containers in GCC/gfortran source code

2016-12-17 Thread Jakub Jelinek
On Sat, Dec 17, 2016 at 11:17:25AM -0500, Frank Ch. Eigler wrote: > Pedro Alves writes: > > > [...] > > malloc will fail, new will throw bad_alloc, and GCC will abort and > > maybe generate a core dump, instead of gracefully printing > > something like: > >cc1: out of memory allocating NN

Re: using C++ STL containers in GCC/gfortran source code

2016-12-17 Thread Frank Ch. Eigler
Pedro Alves writes: > [...] > malloc will fail, new will throw bad_alloc, and GCC will abort and > maybe generate a core dump, instead of gracefully printing > something like: >cc1: out of memory allocating bytes ... > and existing with error status. Consider having the main() funct

Re: using C++ STL containers in GCC/gfortran source code

2016-12-17 Thread Pedro Alves
On 12/17/2016 01:07 PM, Jonathan Wakely wrote: > On 17 December 2016 at 12:28, Pedro Alves wrote: >> On 12/17/2016 12:23 PM, Jonathan Wakely wrote: >>> Instead of replacing the global new operator we could write a custom >>> allocator that uses xmalloc, and we can have e.g. gcc::string as a >>> typ

Re: using C++ STL containers in GCC/gfortran source code

2016-12-17 Thread Jonathan Wakely
On 17 December 2016 at 12:28, Pedro Alves wrote: > On 12/17/2016 12:23 PM, Jonathan Wakely wrote: >> Instead of replacing the global new operator we could write a custom >> allocator that uses xmalloc, and we can have e.g. gcc::string as a >> typedef for std::basic_string, >> gcc::xmallocator> >> >

Re: using C++ STL containers in GCC/gfortran source code

2016-12-17 Thread Pedro Alves
On 12/17/2016 12:23 PM, Jonathan Wakely wrote: > Instead of replacing the global new operator we could write a custom > allocator that uses xmalloc, and we can have e.g. gcc::string as a > typedef for std::basic_string, > gcc::xmallocator> > That doesn't make sense to me, as it leaves the problem

Re: using C++ STL containers in GCC/gfortran source code

2016-12-17 Thread Jonathan Wakely
Instead of replacing the global new operator we could write a custom allocator that uses xmalloc, and we can have e.g. gcc::string as a typedef for std::basic_string, gcc::xmallocator>

Re: using C++ STL containers in GCC/gfortran source code

2016-12-17 Thread Pedro Alves
On 12/17/2016 10:58 AM, Janus Weil wrote: > 2016-12-16 19:46 GMT+01:00 Pedro Alves : > So, it seems like it would be a good idea to follow your suggestion > from PR 78822: > > >> You can replace the global operator new/new[] to call xmalloc instead of >> malloc. >> Then memory allocation by std:

Re: using C++ STL containers in GCC/gfortran source code

2016-12-17 Thread Janus Weil
2016-12-16 19:46 GMT+01:00 Pedro Alves : And in particular: How do the current uses of std::string in GCC deal with this problem? (Do they?) >>> >>> Doesn't look like they do. >> >> Huh, that's a problem then, isn't it? > > Right. The easiest way to trigger it I think is if something > c