diff --git a/src/OpenFOAM/primitives/Tensor/TensorI.H b/src/OpenFOAM/primitives/Tensor/TensorI.H index cb9fea259a..1ee26efa02 100644 --- a/src/OpenFOAM/primitives/Tensor/TensorI.H +++ b/src/OpenFOAM/primitives/Tensor/TensorI.H @@ -514,6 +514,10 @@ inline Foam::Tensor Foam::Tensor::T() const template +#if defined(__GNUC__) && !defined(__clang__) +// Workaround for gcc (11+) that fails to handle tensor dot vector +__attribute__((optimize("no-tree-vectorize"))) +#endif inline Foam::Tensor Foam::Tensor::inner(const Tensor& t2) const { @@ -537,6 +541,10 @@ Foam::Tensor::inner(const Tensor& t2) const template +#if defined(__GNUC__) && !defined(__clang__) +// Workaround for gcc (11+) that fails to handle tensor dot vector +__attribute__((optimize("no-tree-vectorize"))) +#endif inline Foam::Tensor Foam::Tensor::schur(const Tensor& t2) const { @@ -645,7 +653,7 @@ template // Workaround for gcc (11+) that fails to handle tensor dot vector __attribute__((optimize("no-tree-vectorize"))) #endif -inline typename innerProduct, Vector>::type +inline Vector operator&(const Tensor& t, const Vector& v) { return Vector @@ -658,7 +666,11 @@ operator&(const Tensor& t, const Vector& v) template -inline typename innerProduct, Tensor>::type +#if defined(__GNUC__) && !defined(__clang__) +// Workaround for gcc (11+) that fails to handle tensor dot vector +__attribute__((optimize("no-tree-vectorize"))) +#endif +inline Vector operator&(const Vector& v, const Tensor& t) { return Vector @@ -926,6 +938,10 @@ operator-(const Tensor& t1, const SphericalTensor& st2) //- Inner-product between a spherical tensor and a tensor template +#if defined(__GNUC__) && !defined(__clang__) +// Workaround for gcc (11+) that fails to handle tensor dot vector +__attribute__((optimize("no-tree-vectorize"))) +#endif inline Tensor operator&(const SphericalTensor& st1, const Tensor& t2) { @@ -940,6 +956,10 @@ operator&(const SphericalTensor& st1, const Tensor& t2) //- Inner-product between a tensor and a spherical tensor template +#if defined(__GNUC__) && !defined(__clang__) +// Workaround for gcc (11+) that fails to handle tensor dot vector +__attribute__((optimize("no-tree-vectorize"))) +#endif inline Tensor operator&(const Tensor& t1, const SphericalTensor& st2) { @@ -1062,6 +1082,10 @@ operator-(const Tensor& t1, const SymmTensor& st2) //- Inner-product between a symmetric tensor and a tensor template +#if defined(__GNUC__) && !defined(__clang__) +// Workaround for gcc (11+) that fails to handle tensor dot vector +__attribute__((optimize("no-tree-vectorize"))) +#endif inline Tensor operator&(const SymmTensor& st1, const Tensor& t2) { @@ -1084,6 +1108,10 @@ operator&(const SymmTensor& st1, const Tensor& t2) //- Inner-product between a tensor and a symmetric tensor template +#if defined(__GNUC__) && !defined(__clang__) +// Workaround for gcc (11+) that fails to handle tensor dot vector +__attribute__((optimize("no-tree-vectorize"))) +#endif inline Tensor operator&(const Tensor& t1, const SymmTensor& st2) {