diff mbox

[17/17] toplev.c: move location_adhoc_data_fini call

Message ID 1433949898-22033-18-git-send-email-dmalcolm@redhat.com
State New
Headers show

Commit Message

David Malcolm June 10, 2015, 3:24 p.m. UTC
test-functions.c: representation_test.building_cfg and others
need the call to location_adhoc_data_fini to happen later, otherwise
we get a segfault inside gimple_set_block here due to the
adhoc-location data being finalized:

 #0  0x0000000000687800 in ?? ()
 #1  0x00007ffff7504c22 in htab_find_slot (htab=0x6627a0, element=0x7fffffffde90, insert=INSERT)
     at ../../src/libiberty/hashtab.c:704
 #2  0x00007ffff74c0de5 in get_combined_adhoc_loc (set=0x7ffff7ffa000, locus=<optimized out>, data=<optimized out>)
     at ../../src/libcpp/line-map.c:128
 #3  0x00007ffff73cb047 in COMBINE_LOCATION_DATA (block=<optimized out>, loc=<optimized out>, set=<optimized out>)
     at ../../src/gcc/../libcpp/include/line-map.h:794
 #4  gimple_set_block (g=<optimized out>, block=<optimized out>) at ../../src/gcc/gimple.h:1636
 #5  lower_stmt (data=0x7fffffffdfa0, gsi=0x7fffffffdf00) at ../../src/gcc/gimple-low.c:260
 #6  lower_sequence (seq=seq@entry=0x7fffefa310b8, data=data@entry=0x7fffffffdfa0) at ../../src/gcc/gimple-low.c:227
 #7  0x00007ffff73caeef in lower_gimple_bind (gsi=gsi@entry=0x7fffffffdfc0, data=data@entry=0x7fffffffdfa0)
     at ../../src/gcc/gimple-low.c:441
 #8  0x00007ffff73cc675 in lower_function_body () at ../../src/gcc/gimple-low.c:131
 #9  (anonymous namespace)::pass_lower_cf::execute (this=<optimized out>) at ../../src/gcc/gimple-low.c:205
 #10 0x0000000000414030 in (anonymous namespace)::representation_test::build_cfg (this=0x66c520, fndecl=0x7fffefa43ee0)
     at ../../src/gcc/unittests/test-functions.c:293
 #11 0x000000000041787d in (anonymous namespace)::representation_test_building_cfg_Test::TestBody (this=0x66c520)
     at ../../src/gcc/unittests/test-functions.c:501
 #12 0x00007ffff7dcf323 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) () from /lib64/libgtest.so.0
 #13 0x00007ffff7dc4b67 in testing::Test::Run() () from /lib64/libgtest.so.0
 #14 0x00007ffff7dc4c0e in testing::TestInfo::Run() () from /lib64/libgtest.so.0
 #15 0x00007ffff7dc4d15 in testing::TestCase::Run() () from /lib64/libgtest.so.0
 #16 0x00007ffff7dc83a8 in testing::internal::UnitTestImpl::RunAllTests() () from /lib64/libgtest.so.0
 #17 0x00007ffff7dc8647 in testing::UnitTest::Run() () from /lib64/libgtest.so.0
 #18 0x00000000004369cb in main (argc=1, argv=0x7fffffffe478) at ../../src/gcc/unittests/unittests-main.c:107

gcc/ChangeLog:
	* toplev.c (toplev::main): Move call of
	location_adhoc_data_fini from here...
	(toplev::finalize): ...to here.
---
 gcc/toplev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/gcc/toplev.c b/gcc/toplev.c
index 3b57b48..ca2c18c 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -2194,7 +2194,6 @@  toplev::main (int argc, char **argv)
   diagnostic_finish (global_dc);
 
   finalize_plugins ();
-  location_adhoc_data_fini (line_table);
   if (seen_error () || werrorcount)
     return (FATAL_EXIT_CODE);
 
@@ -2230,4 +2229,6 @@  toplev::finalize (void)
   g = NULL;
 
   obstack_free (&opts_obstack, NULL);
+
+  location_adhoc_data_fini (line_table);
 }