[PPL-devel] [GIT] ppl/ppl(ppl-0_11-branch): Grid: avoid using an invalid reference in the constructor from a Box.

Marco Poletti poletti.marco at gmail.com
Fri Feb 11 10:16:31 CET 2011


Module: ppl/ppl
Branch: ppl-0_11-branch
Commit: dd1194cc4d67b72e97dd1d1497ac8df6162589db
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=dd1194cc4d67b72e97dd1d1497ac8df6162589db

Author: Marco Poletti <poletti.marco at 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)) {




More information about the PPL-devel mailing list