[Bug target/39558] Bad interaction of decls named 'vector' and -maltivec vector support

meissner at linux dot vnet dot ibm dot com gcc-bugzilla@gcc.gnu.org
Thu Mar 26 15:24:00 GMT 2009



------- Comment #3 from meissner at linux dot vnet dot ibm dot com  2009-03-26 15:24 -------
Subject: Re:  Bad interaction of decls named 'vector' and -maltivec vector
support

On Thu, Mar 26, 2009 at 02:00:49PM -0000, jakub at gcc dot gnu dot org wrote:
> 
> 
> ------- Comment #2 from jakub at gcc dot gnu dot org  2009-03-26 14:00 -------
> What exact problem do you see?
> #define ATTRIBUTE_UNUSED __attribute__((unused))
> 
> vector int i;
> 
> int *foo (int *vector)
> {
>   return vector;
> }
> 
> int *bar (int *vector ATTRIBUTE_UNUSED)
> {
>   return vector;
> }
> 
> int *baz (int *vector __attribute__((unused)))
> {
>   return vector;
> }
> 
> compiles just fine for me with -maltivec -Wall (and correctly complains only in
> foo about the unused argument).

I just looked at it, and the problem is if you use the -save-temps options
along with -maltivec.  Because -save-temps invokes the preprocessor as a
separate stage, when it expands vector (to be vector) and ATTRIBUTE_UNUSED (to
be __attribute__((unused))), it glues the two tokens together.  Since I'm
looking at power7 code generation right now, I was doing a full bootstrap with
-save-temps to see where the power7 instructions were being generated.

I suspect if we change the default definition of 'vector' to "vector " instead
of "vector" if vector isn't follwed by a type keyword, it will fix the problem
(ditto for bool, etc.).


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39558



More information about the Gcc-bugs mailing list