public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug testsuite/31884]  New: priority_queue_dijkstra.cc operates on deallocated memory
@ 2007-05-09 21:41 amylaar at gcc dot gnu dot org
  2007-05-10 14:02 ` [Bug testsuite/31884] " amylaar at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: amylaar at gcc dot gnu dot org @ 2007-05-09 21:41 UTC (permalink / raw)
  To: gcc-bugs

When libstdc++-v3/testsuite/ext/pb_ds/example/priority_queue_dijkstra.cc
calls p.pop, the highest priority node is deallocated.  All but the last
node are still used after being deallocated.  In particular, the
node with id zero is deallocated after it has been processed.
Then when processing the next closest node to 0, the relaxation loop
calls p_modify with an iterator that points to the memory formerly allocated
to the node that has id 0, thus invoking undefined behaviour.

I see this as a failure on arc-elf32 because the p_modify call mentioned above
calls join_node_children, and that function never returns.


-- 
           Summary: priority_queue_dijkstra.cc operates on deallocated
                    memory
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: testsuite
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: amylaar at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31884


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug testsuite/31884] priority_queue_dijkstra.cc operates on deallocated memory
  2007-05-09 21:41 [Bug testsuite/31884] New: priority_queue_dijkstra.cc operates on deallocated memory amylaar at gcc dot gnu dot org
@ 2007-05-10 14:02 ` amylaar at gcc dot gnu dot org
  2007-08-17 17:24 ` drow at gcc dot gnu dot org
  2007-08-20  0:56 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: amylaar at gcc dot gnu dot org @ 2007-05-10 14:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from amylaar at gcc dot gnu dot org  2007-05-10 15:02 -------
I find that the failure goes away when I assign a_it[0] to the iterator
for the current node before p.pop, and make the loop skip an iteration when it
finds that the iterator for the current neighbor is a_it[0].

Does that also work for you on powerpc?


-- 

amylaar at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dje at watson dot ibm dot
                   |                            |com, bkoz at redhat dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31884


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug testsuite/31884] priority_queue_dijkstra.cc operates on deallocated memory
  2007-05-09 21:41 [Bug testsuite/31884] New: priority_queue_dijkstra.cc operates on deallocated memory amylaar at gcc dot gnu dot org
  2007-05-10 14:02 ` [Bug testsuite/31884] " amylaar at gcc dot gnu dot org
@ 2007-08-17 17:24 ` drow at gcc dot gnu dot org
  2007-08-20  0:56 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: drow at gcc dot gnu dot org @ 2007-08-17 17:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from drow at gcc dot gnu dot org  2007-08-17 17:24 -------
Subject: Bug 31884

Author: drow
Date: Fri Aug 17 17:24:22 2007
New Revision: 127590

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=127590
Log:
        PR testsuite/31884
        * testsuite/ext/pb_ds/example/priority_queue_dijkstra.cc (main): Do
        not access deleted nodes.

        * testsuite/25_algorithms/copy/streambuf_iterators/char/4.cc,
        testsuite/25_algorithms/find/istreambuf_iterators/char/2.cc,
        testsuite/27_io/basic_filebuf/open/char/4.cc,
        testsuite/27_io/objects/char/9.cc: Use dg-require-fileio.
        * testsuite/ext/forced_exception_error/cons_virtual_derivation.cc,
        testsuite/ext/pb_ds/regression/hash_data_map_rand.cc,
        testsuite/ext/pb_ds/regression/trie_data_map_rand.cc,
        testsuite/ext/pb_ds/regression/list_update_no_data_map_rand.cc,
        testsuite/ext/pb_ds/regression/tree_no_data_map_rand.cc,
        testsuite/ext/pb_ds/regression/list_update_data_map_rand.cc,
        testsuite/ext/pb_ds/regression/hash_no_data_map_rand.cc,
        testsuite/ext/pb_ds/regression/priority_queue_rand.cc,
        testsuite/ext/pb_ds/regression/tree_data_map_rand.cc,
        testsuite/ext/pb_ds/regression/trie_no_data_map_rand.cc,
        testsuite/ext/throw_allocator/deallocate_global.cc,
        testsuite/ext/throw_allocator/check_delete.cc,
        testsuite/ext/throw_allocator/check_allocate_max_size.cc,
        testsuite/ext/throw_allocator/check_deallocate_null.cc,
        testsuite/ext/throw_allocator/check_new.cc,
        testsuite/ext/throw_allocator/deallocate_local.cc,
       
testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/cons/gen1.cc,
       
testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/cons/gen1.cc,
       
testsuite/tr1/5_numerical_facilities/random/linear_congruential/cons/gen1.cc,
       
testsuite/tr1/5_numerical_facilities/random/mersenne_twister/cons/gen1.cc,
        testsuite/23_containers/list/modifiers/insert/25288.cc: Use
        dg-require-time.

Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/testsuite/23_containers/list/modifiers/insert/25288.cc
   
trunk/libstdc++-v3/testsuite/25_algorithms/copy/streambuf_iterators/char/4.cc
   
trunk/libstdc++-v3/testsuite/25_algorithms/find/istreambuf_iterators/char/2.cc
    trunk/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/4.cc
    trunk/libstdc++-v3/testsuite/27_io/objects/char/9.cc
   
trunk/libstdc++-v3/testsuite/ext/forced_exception_error/cons_virtual_derivation.cc
    trunk/libstdc++-v3/testsuite/ext/pb_ds/example/priority_queue_dijkstra.cc
    trunk/libstdc++-v3/testsuite/ext/pb_ds/regression/hash_data_map_rand.cc
    trunk/libstdc++-v3/testsuite/ext/pb_ds/regression/hash_no_data_map_rand.cc
   
trunk/libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_data_map_rand.cc
   
trunk/libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_no_data_map_rand.cc
    trunk/libstdc++-v3/testsuite/ext/pb_ds/regression/priority_queue_rand.cc
    trunk/libstdc++-v3/testsuite/ext/pb_ds/regression/tree_data_map_rand.cc
    trunk/libstdc++-v3/testsuite/ext/pb_ds/regression/tree_no_data_map_rand.cc
    trunk/libstdc++-v3/testsuite/ext/pb_ds/regression/trie_data_map_rand.cc
    trunk/libstdc++-v3/testsuite/ext/pb_ds/regression/trie_no_data_map_rand.cc
    trunk/libstdc++-v3/testsuite/ext/throw_allocator/check_allocate_max_size.cc
    trunk/libstdc++-v3/testsuite/ext/throw_allocator/check_deallocate_null.cc
    trunk/libstdc++-v3/testsuite/ext/throw_allocator/check_delete.cc
    trunk/libstdc++-v3/testsuite/ext/throw_allocator/check_new.cc
    trunk/libstdc++-v3/testsuite/ext/throw_allocator/deallocate_global.cc
    trunk/libstdc++-v3/testsuite/ext/throw_allocator/deallocate_local.cc
   
trunk/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/cons/gen1.cc
   
trunk/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/cons/gen1.cc
   
trunk/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/cons/gen1.cc
   
trunk/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/cons/gen1.cc


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31884


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug testsuite/31884] priority_queue_dijkstra.cc operates on deallocated memory
  2007-05-09 21:41 [Bug testsuite/31884] New: priority_queue_dijkstra.cc operates on deallocated memory amylaar at gcc dot gnu dot org
  2007-05-10 14:02 ` [Bug testsuite/31884] " amylaar at gcc dot gnu dot org
  2007-08-17 17:24 ` drow at gcc dot gnu dot org
@ 2007-08-20  0:56 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-08-20  0:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2007-08-20 00:56 -------
This test now works for me on i386-apple-darwin, it was failing before this
patch.
Fixed.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.3.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31884


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-08-20  0:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-09 21:41 [Bug testsuite/31884] New: priority_queue_dijkstra.cc operates on deallocated memory amylaar at gcc dot gnu dot org
2007-05-10 14:02 ` [Bug testsuite/31884] " amylaar at gcc dot gnu dot org
2007-08-17 17:24 ` drow at gcc dot gnu dot org
2007-08-20  0:56 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).