Debian clang version 3.3-debian16precise1 (branches/release_33) (based on LLVM 3.3)
Target: x86_64-pc-linux-gnu
Thread model: posix
#include < vector>
#include < iostream>
using std::vector;
using std::cout;
using std::endl;
struct P {
vector<unsigned > v1;
vector<unsigned > v2;
P (unsigned l): v1(l), v2(l) {
for (unsigned i = l; i > 0 ; --i) {
v1[i - 1 ] = v2[i - 1 ] = i - 1 ;
}
for (unsigned i = 0 ; i < l; i++) {
cout << " v1[" << i << " ] = " << v1[i] << " \t " ;
cout << " v2[" << i << " ] = " << v2[i] << endl;
}
}
};
int main () {
P p (9 );
return 0 ;
}
clang++-3.3 -O3 test.cpp
Correct Output (without -O3
)
v1[0] = 0 v2[0] = 0
v1[1] = 1 v2[1] = 1
v1[2] = 2 v2[2] = 2
v1[3] = 3 v2[3] = 3
v1[4] = 4 v2[4] = 4
v1[5] = 5 v2[5] = 5
v1[6] = 6 v2[6] = 6
v1[7] = 7 v2[7] = 7
v1[8] = 8 v2[8] = 8
v1[0] = 0 v2[0] = 0
v1[1] = 2 v2[1] = 1
v1[2] = 1 v2[2] = 2
v1[3] = 4 v2[3] = 3
v1[4] = 3 v2[4] = 4
v1[5] = 6 v2[5] = 5
v1[6] = 5 v2[6] = 6
v1[7] = 8 v2[7] = 7
v1[8] = 7 v2[8] = 8