bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] inttostr.h: add compile-time buffer overrun checks


From: Paul Eggert
Subject: Re: [PATCH] inttostr.h: add compile-time buffer overrun checks
Date: Mon, 25 Oct 2010 11:35:08 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.14) Gecko/20101006 Thunderbird/3.0.9

On 10/25/10 11:00, Paolo Bonzini wrote:
> I can take a look at the code, it is definitely safe with GCC 4 and
> -fno-tree-ter.

Thanks.  The idea would be that, if we can check at configure-time
or compile-time whether it's safe, then we could fall back on
alloca rather than malloc.

While we're looking into GCC, what I'd like is the ability to say
something like this:

  (char [100]) { ? }

meaning, I want a 100-byte buffer that is uninitialized.  Here, the
"?" is an extension to the initializer syntax which means that the
object has an unspecified value, much as "char x[100];" declares
a local variable X with an unspecified value.  I don't care what
syntax to use, so if it's better to use a new __builtin_unspecified
gizmo than to use ?, that's fine.

The advantage of this is that GCC would no longer have to initialize
the buffer to zero.  This initialization is entirely a waste of time
in the proposed inttostr change.

Would it be reasonable to propose something like this for GCC?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]