This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/49761] New: restrict keyword ignored if in structure
- From: "vincenzo.innocente at cern dot ch" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 16 Jul 2011 09:52:11 +0000
- Subject: [Bug tree-optimization/49761] New: restrict keyword ignored if in structure
- Auto-submitted: auto-generated
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: unassigned@gcc.gnu.org
ReportedBy: vincenzo.innocente@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;
}