From 9267296c277ebe6616ef06165a02d752085d8194 Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Sun, 11 Oct 2020 14:14:53 -0400 Subject: [PATCH] work around gcc segfault in tensor.h MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit gcc 5.4.0 with -O1 in debug mode segfaults with ``` In file included from ../include/deal.II/base/symmetric_tensor.h:25:0, from ../include/deal.II/base/array_view.h:23, from ../source/fe/fe_values.cc:16, from ../source/fe/fe_values_inst4.cc:17: ../include/deal.II/base/tensor.h: In function ‘void dealii::FEValuesViews::internal::do_function_symmetric_gradients(const dealii::ArrayView&, const dealii::Table<2, dealii::Tensor<1, spacedim> >&, const std::vector::ShapeFunctionData>&, std::vector >::type>&) [with int dim = 1; int spacedim = 1; Number = std::complex; typename dealii::FEValuesViews::Vector::ShapeFunctionData = dealii::FEValuesViews::Vector<1, 1>::ShapeFunctionData; typename dealii::ProductType >::type = dealii::SymmetricTensor<2, 1, std::complex >]’: ../include/deal.II/base/tensor.h:497:35: in constexpr expansion of ‘(long unsigned int)(__first + 16u)()’ ../include/deal.II/base/tensor.h:497:35: in constexpr expansion of ‘()’ ../include/deal.II/base/tensor.h:497:35: in constexpr expansion of ‘dealii::Tensor<2, 1, double>()’ ../include/deal.II/base/tensor.h:497:35: in constexpr expansion of ‘(void*)__first()’ In file included from ../source/fe/fe_values_inst4.cc:17:0: ../source/fe/fe_values.cc:700:5: internal compiler error: Segmentation fault do_function_symmetric_gradients( ``` Work around this by changing the constructor. --- include/deal.II/base/tensor.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/include/deal.II/base/tensor.h b/include/deal.II/base/tensor.h index f7a0797c94..e13fcac55d 100644 --- a/include/deal.II/base/tensor.h +++ b/include/deal.II/base/tensor.h @@ -495,12 +495,10 @@ public: */ constexpr DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV Tensor() -#ifdef DEAL_II_MSVC + // We would like to use =default, but this causes compile errors with some + // MSVC versions and internal compiler errors with -O1 in gcc 5.4. : values{} {} -#else - = default; -#endif /** * A constructor where the data is copied from a C-style array. -- 2.39.5