This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GCC 4.5: "nonconstant array index in initializer" error


On Sat, 25 Apr 2009, Denis Onischenko wrote:

> Thanks for the patch.
> 
> There are another error while building linux kernel with GCC 4.5.0
> revision 146771.
> 
> The minimal code for reproducing the error looks like:
> 
> extern unsigned int __invalid_size_argument;
> #define TYPECHECK(t)    ( sizeof(t) == sizeof(t[1]) ?  sizeof(t) :
> __invalid_size_argument )
> 
> enum {
>      ENUM_VALUE_NAME = TYPECHECK(int),

Is the kernel using this sort of non-integer-constant-expression in 
bit-field widths as well?  Sizes of file-scope arrays (OK, a special case 
for that was added for WINE)?  Null pointer constants (that's much more 
problematic to add special cases for)?  __builtin_choose_expr conditions?  
It seems to be making rather a lot of use of an old obscure undocumented 
extension.

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]