]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Workaround rocm 5.7 compiler bug in debug mode
authorBruno Turcksin <bruno.turcksin@gmail.com>
Fri, 22 Nov 2024 21:02:06 +0000 (16:02 -0500)
committerBruno Turcksin <bruno.turcksin@gmail.com>
Fri, 22 Nov 2024 21:02:33 +0000 (16:02 -0500)
source/grid/grid_out.cc

index 421013ae02258030b04cbc6cf5bcf88ac0e032bb..3e5d34603ed54f293829367c0a1bf941440b8011 100644 (file)
@@ -2139,7 +2139,13 @@ GridOut::write_svg(const Triangulation<2, 2> &tria, std::ostream &out) const
           double h;
 
           if (n != 1)
-            h = .6 - (index / (n - 1.)) * .6;
+            {
+              // The assert is a workaround a compiler bug in ROCm 5.7 which
+              // evaluated index/(n-1) when n == 1 in debug mode. When adding
+              // the assert the ratio is not evaluated.
+              Assert((n - 1.) != 0., ExcInvalidState());
+              h = .6 - (index / (n - 1.)) * .6;
+            }
           else
             h = .6;
 

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.