From 6f62d30a8043728a87ee0d3b30b41d477671bd25 Mon Sep 17 00:00:00 2001
From: Timo Koch <timo.koch@iws.uni-stuttgart.de>
Date: Mon, 5 Jun 2017 17:27:32 +0200
Subject: [PATCH] [gmres][bugfix] Fix double call of prec->post(x) when res is
 zero

The post-processing routine was called twice, once before the outer
while loop and once after when the residual was initially zero. This
lead to a segmentation fault in the AMG preconditioner.
Now it only gets called once.
---
 dune/istl/solvers.hh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dune/istl/solvers.hh b/dune/istl/solvers.hh
index cf947062f..cb547207c 100644
--- a/dune/istl/solvers.hh
+++ b/dune/istl/solvers.hh
@@ -1123,8 +1123,8 @@ namespace Dune {
           }
         }
 
-      if(Simd::allTrue(norm_0 < EPSILON)) {
-        _prec->post(x);
+      if(Simd::allTrue(norm_0 < EPSILON))
+      {
         res.converged = true;
         if(_verbose > 0) // final print
           print_result(res);
-- 
GitLab