This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Fold __builtin_constant_p immediately when in the first argument of __builtin_choose_expr (PR c/19449)
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 2 Apr 2013 22:43:04 +0000
- Subject: Re: [PATCH] Fold __builtin_constant_p immediately when in the first argument of __builtin_choose_expr (PR c/19449)
- References: <20130402112519 dot GJ20616 at tucnak dot redhat dot com>
On Tue, 2 Apr 2013, Jakub Jelinek wrote:
> The following patch folds it there immediately too. Bootstrapped/regtested
> on x86_64-linux and i686-linux, ok for trunk?
> BTW, in the PR I've also mentioned what has been reported to the Red Hat
> bugzilla about __builtin_constant_p in array bounds of static (or extern)
> arrays in block contexts. Those can't be VLAs, so we want to know the
> constant bound, but if __builtin_constant_p is used there, we error on it
> (while at file scope it compiles fine, because if cfun is NULL, we fold
> __builtin_constant_p immediately). Any suggestions how to fix that?
It's not going to be as simple as using information about the declaration
specifiers when parsing array declarators, because a static pointer to VLA
is valid, so it would also be necessary to distinguish whether the
declaration in question is actually going to be of a static array itself.
Joseph S. Myers