This is the mail archive of the gcc-patches@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: [C patch] Fix non-regression part of PR29092


On Tue, 26 Sep 2006, Paolo Bonzini wrote:

> The PR is about a failure of the C front-end to accept
> 
> __attribute__ ((vector_size (8))) int x =
>   (__attribute__ ((vector_size (8))) int) {1, 2};
> 
> The similar code
> 
>  typedef __attribute__ ((vector_size (8))) int vec_int;
>  vec_int x =  (vec_int) {1, 2};
> 
> never compiled for --std=gnu99.  The problem is that initializing objects with
> static storage duration with compound literals, was allowed by gnu89 and not
> gnu99.  This patch enables the extension at gnu99 too.

Not having this extension at gnu99 was a deliberate decision, in 
recognition of how C99's compound literals differ from the old GNU 
"constructor expressions" extension; that is, the compound literal is a 
temporary object and you wouldn't allow such initialization with a named 
object instead of a compound literal as initializer.

However, this decision was for structure and union types and different 
considerations may apply for vector types which aren't in the standard at 
all.

-- 
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]