[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GCC and __builtin_object_size
From: |
Bruno Haible |
Subject: |
Re: GCC and __builtin_object_size |
Date: |
Mon, 25 Oct 2010 11:34:53 +0200 |
User-agent: |
KMail/1.9.9 |
Paul Eggert wrote:
> +/* Buffer too small: would like warning at compile time, but cannot
> + easily do it due to GCC's mishandling of __builtin_object_size. */
I would reformulate this comment. The problem that you have with
__builtin_object_size is that it cannot be part of a constant expression. But
that is not a "mishandling" IMO: the building bricks of constant expressions
are defined in ISO C. I see no compelling reason why GCC should extend its
notion of constant expressions.
One thing is troubling me, however: That __builtin_object_size can not return
a really non-constant expression. In this case
char buf[n < 0 ? 21 : 20];
return strdup (inttostr (n, &buf[0]));
it returns (size_t)-1, that is, it gives up.
Bruno
- Re: [PATCH] inttostr.h: add compile-time buffer overrun checks, (continued)
- Re: [PATCH] inttostr.h: add compile-time buffer overrun checks, Paul Eggert, 2010/10/18
- Re: [PATCH] inttostr.h: add compile-time buffer overrun checks, Paul Eggert, 2010/10/18
- Re: [PATCH] inttostr.h: add compile-time buffer overrun checks, Bruno Haible, 2010/10/18
- Re: [PATCH] inttostr.h: add compile-time buffer overrun checks, Paul Eggert, 2010/10/19
- Re: [PATCH] inttostr.h: add compile-time buffer overrun checks, Jim Meyering, 2010/10/19
- Re: [PATCH] inttostr.h: add compile-time buffer overrun checks, Paul Eggert, 2010/10/24
- Re: [PATCH] inttostr.h: add compile-time buffer overrun checks, Jim Meyering, 2010/10/25
- Re: [PATCH] inttostr.h: add compile-time buffer overrun checks, Bruno Haible, 2010/10/25
- Re: GCC and __builtin_object_size,
Bruno Haible <=
- Re: [PATCH] inttostr.h: add compile-time buffer overrun checks, Paolo Bonzini, 2010/10/25
- Re: [PATCH] inttostr.h: add compile-time buffer overrun checks, Paul Eggert, 2010/10/25
- Re: [PATCH] inttostr.h: add compile-time buffer overrun checks, Paolo Bonzini, 2010/10/25
- Re: [PATCH] inttostr.h: add compile-time buffer overrun checks, Paul Eggert, 2010/10/25
- Re: alloc_size attribute, Bruno Haible, 2010/10/17
- Re: alloc_size attribute, Jim Meyering, 2010/10/17
- Re: alloc_size attribute, Bruno Haible, 2010/10/17
- Re: alloc_size attribute, Jim Meyering, 2010/10/17