fix pr38240 -- attribute target

Richard Henderson
Mon Dec 8 17:30:00 GMT 2008

I have trouble believing that attribute target ever got any real testing 
when it was added, because the very first thing I tried to do with it 
(to wit: return a vector value from a function marked for sse) crashed 
the compiler.  There were two main problems:

   * Vector modes (e.g. V4SF) were only being assigned to vector types
     if the vector mode was valid at the instant that the vector type
     was declared.  This means, for instance, that you couldn't declare
     a data structure in generic code, and have it be interpreted two
     different ways by SSE code and non-SSE code.  Also, it means you
     couldn't include one of the intrinsics header files and use those
     intrinsics in functions specially marked for SSE.

   * Installing the backend state associated with attribute target did
     not happen early enough.  We were initializing parts of struct
     function based on backend queries that depended on the state
     associated with attribute target.

The fix to the second problem is trivial -- just install the state
earlier.  The fix to the first problem is to make vector types
re-validate their mode every time.  This does, however, mean that
sets to TYPE_MODE now have to go through a different accessor, which
is where the bulk of the changes in this patch come from.

Tested on x86-64-linux.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: d-38240
URL: <>

More information about the Gcc-patches mailing list