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: adding -fnoalias ... would a patch be accepted ?


On Wed, Jan 06, 2010 at 04:49:29PM +0100, Richard Guenther wrote:
> On Wed, Jan 6, 2010 at 4:45 PM, Richard Guenther
> <richard.guenther@gmail.com> wrote:
> > On Wed, Jan 6, 2010 at 4:25 PM, torbenh <torbenh@gmx.de> wrote:
> >>> >
> >>> > Mixer<Ramp,Ramp,Ramp,Ramp> mix __attribute__((restrict))
> >>
> >> void fill_buffer( float * __restrict buf, size_t nframes )
> >> {
> >> ? ? for( size_t i=0; i<nframes; i++ )
> >> ? ? ? ? buf[i] = mix.process();
> >> }
> 
> Btw, the same effect can be obtained by instead writing
> 
> void fill_buffer( float * __restrict buf, size_t nframes )
> {
>      Mixer<Ramp,Ramp,Ramp,Ramp> * restrict mixp = &mix;
>      for( size_t i=0; i<nframes; i++ )
>          buf[i] = mix->process();
> }
> 
> at least in theory (if it doesn't work its worth to try to fix it).

in gcc-4.4 it doesnt work. didnt test with trunk yet.
but the text here suggests, that it should never work.
from gcc/alias.c get_alias_set (tree t):

  else if (AGGREGATE_TYPE_P (pointed_to_type))
    /* For an aggregate, we must treat the restricted
       pointer the same as an ordinary pointer.  If we
       were to make the type pointed to by the
       restricted pointer a subset of the pointed-to
       type, then we would believe that other subsets
       of the pointed-to type (such as fields of that
       type) do not conflict with the type pointed to
       by the restricted pointer.  */
    DECL_POINTER_ALIAS_SET (decl)
      = pointed_to_alias_set;

> 
> Richard.

-- 
torben Hohn


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