This is the mail archive of the gcc-bugs@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]

[Bug c++/42633] New: hinting gcc that restricted pointer dont alias with members of structs


there is currently no way to hint gcc that a restricted pointer
doesnt alias with a member of a struct.

quoting Richard Guenther on this:
------------------------------------------------------------------------------
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();
}                                                                               
-------------------------------------------------------------------------


-- 
           Summary: hinting gcc that restricted pointer dont alias with
                    members of structs
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: torbenh at gmx dot de


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


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