Skip to content

Commit

Permalink
Avoid GCC optimizer doing things
Browse files Browse the repository at this point in the history
  • Loading branch information
miscco committed Sep 20, 2024
1 parent 1806b28 commit 54b1fd9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions thrust/testing/transform_input_output_iterator.cu
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@

#include <unittest/unittest.h>

// There is a unfortunate miscompilation of the gcc-11 vectorizer leading to OOB writes
// Adding this attribute suffices that this miscompilation does not appear anymore
#if defined(_CCCL_COMPILER_GCC) && __GNUC__ >= 11
# define THRUST_DISABLE_BROKEN_GCC_VECTORIZER __attribute__((optimize("no-tree-vectorize")))
#else
# define THRUST_DISABLE_BROKEN_GCC_VECTORIZER
#endif

template <class Vector>
void TestTransformInputOutputIterator()
THRUST_DISABLE_BROKEN_GCC_VECTORIZER void TestTransformInputOutputIterator()
{
using T = typename Vector::value_type;

Expand Down Expand Up @@ -52,7 +60,7 @@ void TestTransformInputOutputIterator()
DECLARE_VECTOR_UNITTEST(TestTransformInputOutputIterator);

template <class Vector>
void TestMakeTransformInputOutputIterator()
THRUST_DISABLE_BROKEN_GCC_VECTORIZER void TestMakeTransformInputOutputIterator()
{
using T = typename Vector::value_type;

Expand Down

0 comments on commit 54b1fd9

Please sign in to comment.