From ed7a3dcca2ef2e52b9bcfb86b0d003f1a7ebaa0b Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Sun, 14 Jun 2015 23:05:20 -0400 Subject: [PATCH 1/2] FIX: make sure nans are dealt with in path With gcc 5.1.0 it seems that the inner loop of the fast-path in PathNanRemover gets optimized out of existence and the first non-finite entry in the path prevents any further drawing. This PR (rather hackishly) adds explicit de-references to x and y to the loop to make sure the compiler does not decide it is unneeded. Closes #4525 --- src/path_converters.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/path_converters.h b/src/path_converters.h index 77557720f054..06bcd969604f 100644 --- a/src/path_converters.h +++ b/src/path_converters.h @@ -218,15 +218,21 @@ class PathNanRemover : protected EmbeddedQueue<4> code == (agg::path_cmd_end_poly | agg::path_flags_close)) { return code; } + double _x, _y; if (MPL_notisfinite64(*x) || MPL_notisfinite64(*y)) { do { code = m_source->vertex(x, y); + // This de-reference makes sure this loop is not + // optimized out of existence + _x = *x; + _y = *y; + if (code == agg::path_cmd_stop || code == (agg::path_cmd_end_poly | agg::path_flags_close)) { return code; } - } while (MPL_notisfinite64(*x) || MPL_notisfinite64(*y)); + } while (MPL_notisfinite64(_x) || MPL_notisfinite64(_y)); return agg::path_cmd_move_to; } From b87baf42ed7a789808ced915cbe4e7dc9c6e7c77 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Mon, 15 Jun 2015 10:02:08 -0400 Subject: [PATCH 2/2] DOC: make comment clearer This looks like a bad idea, but this is working around a complier bug. --- src/path_converters.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/path_converters.h b/src/path_converters.h index 06bcd969604f..adf4cf621057 100644 --- a/src/path_converters.h +++ b/src/path_converters.h @@ -225,6 +225,7 @@ class PathNanRemover : protected EmbeddedQueue<4> code = m_source->vertex(x, y); // This de-reference makes sure this loop is not // optimized out of existence + // This is working around an apparent bug in gcc 5.1 _x = *x; _y = *y;