On 09/24/14 14:24, Joseph S. Myers wrote:
On Wed, 24 Sep 2014, David Malcolm wrote:
The ideal I'm aiming for here is that a well-behaved library should
never abort, so I've rewritten these functions to use vasprintf, and
added error-handling checks to cover the case where malloc returns NULL
within vasprintf.
GCC is designed on the basis of aborting on allocation failures - as is
GMP, which allows custom allocation functions to be specified but still
requires them to exit the program rather than return, longjmp or throw an
exception.
But that may be something we need to change if GCC is going to be used
at a JIT in the future. Yea, we'll still have problems of this nature
in libraries that GCC itself might use such as gmp, but that doesn't
mean that we have to perpetuate that practice in GCC itself.
Presumably I should address this in a followup, by making that be
dynamically-allocated?
Yes. Arbitrary limits should be avoided in GNU.
Agreed.
jeff