]> https://gitweb.dealii.org/ - dealii.git/commitdiff
work around gcc segfault in tensor.h
authorTimo Heister <timo.heister@gmail.com>
Sun, 11 Oct 2020 18:14:53 +0000 (14:14 -0400)
committerTimo Heister <timo.heister@gmail.com>
Sun, 11 Oct 2020 18:14:53 +0000 (14:14 -0400)
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<Number>&, const dealii::Table<2, dealii::Tensor<1,
spacedim> >&, const std::vector<typename
dealii::FEValuesViews::Vector<dim, spacedim>::ShapeFunctionData>&,
std::vector<typename dealii::ProductType<Number,
dealii::SymmetricTensor<2, spacedim> >::type>&) [with int dim = 1; int
spacedim = 1; Number = std::complex<double>; typename
dealii::FEValuesViews::Vector<dim, spacedim>::ShapeFunctionData =
dealii::FEValuesViews::Vector<1, 1>::ShapeFunctionData; typename
dealii::ProductType<Number, dealii::SymmetricTensor<2, spacedim> >::type
= dealii::SymmetricTensor<2, 1, std::complex<double> >]’:
../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
‘<expression error>()’
../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

index f7a0797c941ec5f129add7880b645a3fb182e98f..e13fcac55de652a3433511160c9e4bee04dda48c 100644 (file)
@@ -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.

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.