test_concurrent_vector bug or trick ?

test_concurrent_vector bug or trick ?


This code comes from test_concurrent_vector.cpp (tbb40_20111130):

templatevoid TestVectorTypes() { tbb::concurrent_vector v; for( int i=0; i<100; ++i ) { // VC8 does not properly align a temporary value; to work around, use explicit variable ClassWithVectorType foo(i); v.push_back(foo); for( int j=0; i ClassWithVectorType bar(j); ASSERT( v[j]==bar, NULL ); } }}Is the self-comparison (i
It is here at least since vers tbb30_20100406.
I found it because it throws a warning when compiling with clang.

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

It's a bug (the test should be for j
The comment about alignment is a bit intriguing...

Yes there are more, and I'll post it in 15 minutes (more or less)

I'm not sure if gcc must throw this warning, but the others I've found are warnings that gcc missed and theoretically must throw.

Thank you very much for catching and reporting it.
it is definitely a bug that have to be fixed.

If you have more issues of the type you are very welcome to post it.

Leave a Comment

Please sign in to add a comment. Not a member? Join today