Skip to content

Commit

Permalink
FIX: make sure nans are dealt with in path
Browse files Browse the repository at this point in the history
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 matplotlib#4252
  • Loading branch information
tacaswell committed Jun 15, 2015
1 parent a165735 commit 0c14164
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/path_converters.h
Expand Up @@ -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 {
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;
}

Expand Down

0 comments on commit 0c14164

Please sign in to comment.