diff --git a/src/OpenFOAM/primitives/Tensor/TensorI.H b/src/OpenFOAM/primitives/Tensor/TensorI.H index e6662fbde9..5a1cbb2714 100644 --- a/src/OpenFOAM/primitives/Tensor/TensorI.H +++ b/src/OpenFOAM/primitives/Tensor/TensorI.H @@ -535,6 +535,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 { @@ -558,6 +562,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 { @@ -993,6 +1001,10 @@ operator&(const Tensor& t1, const Tensor& t2) //- Inner-product of a SphericalTensor 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) { @@ -1007,6 +1019,10 @@ operator&(const SphericalTensor& st1, const Tensor& t2) //- Inner-product of a Tensor and a SphericalTensor 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) { @@ -1021,6 +1037,10 @@ operator&(const Tensor& t1, const SphericalTensor& st2) //- Inner-product of a SymmTensor 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) { @@ -1043,6 +1063,10 @@ operator&(const SymmTensor& st1, const Tensor& t2) //- Inner-product of a Tensor and a SymmTensor 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) { @@ -1069,7 +1093,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 @@ -1083,7 +1107,11 @@ operator&(const Tensor& t, const Vector& v) //- Inner-product of a Vector and a Tensor 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