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#4525
  • Loading branch information
tacaswell committed Jun 15, 2015
1 parent a165735 commit ed7a3dc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion 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 {
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 ed7a3dc

Please sign in to comment.