This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C patch] Fix non-regression part of PR29092
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Paolo Bonzini <paolo dot bonzini at lu dot unisi dot ch>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 27 Sep 2006 11:28:35 +0000 (UTC)
- Subject: Re: [C patch] Fix non-regression part of PR29092
- References: <4518FB54.5020600@lu.unisi.ch>
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