On Tue, Jan 5, 2010 at 4:03 PM, torbenh <torb...@gmx.de> wrote:
> On Tue, Jan 05, 2010 at 02:46:30PM +0100, Richard Guenther wrote:
>> On Tue, Jan 5, 2010 at 2:40 PM, torbenh <torb...@gmx.de> wrote:
>>
>> The -fno-alias-X things do not make much sense for user code (they
>> have been historically used from Frontends).  If restrict doesn't work
>> for you (do you have a testcase that can reproduce your issue?)
>> then you probably need to wait for IPA pointer analysis to be
>> fixed in GCC 4.6.
>
> sorry... forget the attachment :S

Yes, in this case you can fix it by making ramp static.  Otherwise its
address may be takein in another translation unit.  For Fortran we
have the DECL_RESTRICTED_P which we could expose to other
languages via an attribute.  It tells that a decl is not aliased by
restrict qualified pointers, so

struct Ramp {
    float phase;
    inline float process() { return phase++; }
} ramp __attribute__((restrict));

void fill_buffer( float * __restrict buf, size_t nframes )
{
    for( size_t i=0; i<nframes; i++ )
        buf[i] = ramp.process();
}

would then be optimized as well.  Can you file an enhancement
bugreport according to this?

Thanks,
Richard.

Reply via email to