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.guent...@gmail.com> wrote: > > On Wed, Jan 6, 2010 at 4:25 PM, torbenh <torb...@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