http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49761
Summary: restrict keyword ignored if in structure Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: major Priority: P3 Component: tree-optimization AssignedTo: unassig...@gcc.gnu.org ReportedBy: vincenzo.innoce...@cern.ch in this example no alias checks are generated for the first function while there are generated when inlined in the second and third functions. Is it correct to declare an array "restricted" in a structure? compiled with c++ -Wall -ftree-vectorizer-verbose=7 -Ofast -c gcc version 4.7.0 20110528 (experimental) (GCC) struct SoA { int * __restrict__ a; float * __restrict__ b; float * __restrict__ c; int size; }; struct SoB { int * __restrict__ a; float * __restrict__ b; int size; }; void loop( int const * __restrict__ in_a, float const * __restrict__ in_b, float const * __restrict__ in_c, int * __restrict__ out_a, float * __restrict__ out_b, int N, int & k) { int j=k; for (int i=0; i!=N; ++i) { out_b[j] = in_c[i]+in_b[i]; out_a[j] = in_a[i]; ++ j; } k = j; } void loop2(SoA const & in, SoB & out, int & k) { loop(in.a,in.b,in.c, out.a,out.b, in.size, k); } void loop3(SoA const & in, SoB & out, int & k) { int j=k; int N=in.size; for (int i=0; i!=N; ++i) { out.b[j] = in.c[i]+in.b[i]; out.a[j] = in.a[i]; ++j; } k = j; }