[GIT] ppl/ppl(pip): Grid: avoid using an invalid reference in the constructor from a Box.

Module: ppl/ppl Branch: pip Commit: a01fecf4cde756aaefe88b8f309f9bdf3e07b670 URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=a01fecf4cde75...
Author: Marco Poletti poletti.marco@gmail.com Date: Sat Feb 5 09:58:54 2011 +0100
Grid: avoid using an invalid reference in the constructor from a Box.
---
src/Grid.templates.hh | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/src/Grid.templates.hh b/src/Grid.templates.hh index d202f83..51b01a3 100644 --- a/src/Grid.templates.hh +++ b/src/Grid.templates.hh @@ -63,8 +63,10 @@ Grid::Grid(const Box<Interval>& box, PPL_DIRTY_TEMP_COEFFICIENT(u_n); PPL_DIRTY_TEMP_COEFFICIENT(u_d); gen_sys.insert(grid_point(0*Variable(space_dim-1))); - Grid_Generator& point = gen_sys[0]; for (dimension_type k = space_dim; k-- > 0; ) { + // This is declared here because it may be invalidated by the call to + // gen_sys.insert() at the end of the loop. + Grid_Generator& point = gen_sys[0]; bool closed = false; // TODO: Consider producing the system(s) in minimized form. if (box.get_lower_bound(k, closed, l_n, l_d)) {
participants (1)
-
Marco Poletti