Opened 8 years ago

Last modified 7 years ago

#10896 new Bugs

astar_maze.cpp: Debug assertion under Windows MSVC-12

Reported by: georg@… Owned by: Jeremiah Willcock
Milestone: To Be Determined Component: graph
Version: Boost 1.57.0 Severity: Problem
Keywords: Cc:

Description

Dear maintainers, the example astar_maze.cpp compiled under Windows 7 x64 as 32 Bit executable, throws a debug assertion. See the callstack (attachment). I called this example without any arguments from the debugger so it used the default grid size of 20x20.

The assertion get triggered at

bucket_pointer get_bucket(std::size_t bucket_index) const

{

---> BOOST_ASSERT(buckets_);

return buckets_ + static_cast<std::ptrdiff_t>(bucket_index);

}

buckets_ is nullptr.

Environment: Windows 7 x 64 Visual Studio 2013 Update 4 Express for Desktop

Attachments:

  • callstack
  • minidump
  • solution folder (compressed)

Attachments (3)

astar-maze.zip (9.9 KB ) - added by georg@… 8 years ago.
call-stack.txt (10.8 KB ) - added by anonymous 8 years ago.
astar_maze2.cpp (9.8 KB ) - added by georg@… 8 years ago.
rewritten sample astar_maze2.cpp

Download all attachments as: .zip

Change History (8)

by georg@…, 8 years ago

Attachment: astar-maze.zip added

by anonymous, 8 years ago

Attachment: call-stack.txt added

comment:1 by georg@…, 8 years ago

I decided to dont upload the minidump because the minidump is too big (40 MB).

comment:2 by georg@…, 8 years ago

P.S.: I forgot to mention, under release build the executable doesnt dump and it solves the maze.

comment:3 by georg@…, 8 years ago

Component: Nonegraph
Owner: set to Jeremiah Willcock

by georg@…, 8 years ago

Attachment: astar_maze2.cpp added

rewritten sample astar_maze2.cpp

comment:4 by georg@…, 8 years ago

I added the rewritten sample.

comment:5 by anonymous, 7 years ago

A simpler solution would be to have random_maze function return a pointer to maze, as below.

maze* random_maze(std::size_t x, std::size_t y) {

maze* m = new maze(x, y); vertices_size_type n = num_vertices(m->m_grid); vertex_descriptor s = m->source(); vertex_descriptor g = m->goal(); One quarter of the cells in the maze should be barriers. int barriers = n / 4;

while (barriers > 0) {

Choose horizontal or vertical direction. std::size_t direction = random_int(0, 1); Walls range up to one quarter the dimension length in this direction. vertices_size_type wall = random_int(1, m->length(direction) / 4); Create the wall while decrementing the total barrier count. vertex_descriptor u = vertex(random_int(0, n - 1), m->m_grid); while (wall) {

Start and goal spaces should never be barriers. if (u != s && u != g) {

wall--; if (!m->has_barrier(u)) {

m->m_barriers.insert(u); barriers--;

}

} vertex_descriptor v = m->m_grid.next(u, direction); Stop creating this wall if we reached the maze's edge. if (u == v)

break;

u = v;

}

}

return m;

}

Note: See TracTickets for help on using tickets.