diff mbox

Fix PR79814

Message ID alpine.LSU.2.20.1704251133060.24645@zhemvz.fhfr.qr
State New
Headers show

Commit Message

Richard Biener April 25, 2017, 9:34 a.m. UTC
On Tue, 25 Apr 2017, Andreas Schwab wrote:

> On Apr 21 2017, Richard Biener <rguenther@suse.de> wrote:
> 
> > The following fixes uninitialized uses in pass_manager::pass_manager
> > which causes bootstrap failure when a fix for PR2972 is applied.
> 
> This fails to properly initialize the pass_manager instance, causing cc1
> to crash later.
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x4000000000b417c1 in hash_table<hash_map<nofree_string_hash, opt_pass*, simple_hashmap_traits<default_hash_traits<nofree_string_hash>, opt_pass*> >::hash_entry, xcallocator>::find_with_hash (this=0x2000000000988140 <_IO_2_1_stderr_>, 
>     comparable=@0x600ffffffffee790: 0x60000000002f3870 "tree-omplower", 
>     hash=1802803413) at ../../gcc/hash-map.h:57
> 57          static bool is_empty (const hash_entry &e) { return Traits::is_empty (e); }
> (gdb) bt
> #0  0x4000000000b417c1 in hash_table<hash_map<nofree_string_hash, opt_pass*, simple_hashmap_traits<default_hash_traits<nofree_string_hash>, opt_pass*> >::hash_entry, xcallocator>::find_with_hash (this=0x2000000000988140 <_IO_2_1_stderr_>, 
>     comparable=@0x600ffffffffee790: 0x60000000002f3870 "tree-omplower", 
>     hash=1802803413) at ../../gcc/hash-map.h:57
> #1  0x4000000000b28e30 in hash_map<nofree_string_hash, opt_pass*, simple_hashmap_traits<default_hash_traits<nofree_string_hash>, opt_pass*> >::get (
>     k=@0x600ffffffffee790: 0x60000000002f3870 "tree-omplower", 
>     this=0x2000000000988140 <_IO_2_1_stderr_>) at ../../gcc/hash-map.h:150
> #2  gcc::pass_manager::register_pass_name (this=0x60000000002ea0c0, 
>     pass=0x60000000002e7750, name=0x60000000002f3870 "tree-omplower")
>     at ../../gcc/passes.c:857
> #3  0x4000000000b29850 in gcc::pass_manager::register_one_dump_file (
>     this=0x60000000002ea0c0, pass=0x60000000002e7750) at ../../gcc/passes.c:827
> #4  0x4000000000b29b00 in gcc::pass_manager::register_dump_files (
>     this=0x60000000002ea0c0, pass=0x60000000002e7750) at ../../gcc/passes.c:839
> #5  0x4000000000b3f4b0 in gcc::pass_manager::pass_manager (
>     this=0x60000000002ea0c0, ctxt=<optimized out>) at ../../gcc/passes.c:1607
> #6  0x400000000049f110 in gcc::context::context (this=0x60000000002a2f00)
>     at ../../gcc/context.c:39
> #7  0x400000000017def0 in general_init (init_signals=<optimized out>, 
>     argv0=<optimized out>) at ../../gcc/toplev.c:1159
> #8  toplev::main (this=0x600ffffffffef0e0, argc=2, argv=0x600ffffffffef388)
>     at ../../gcc/toplev.c:2089
> #9  0x4000000000183e90 in main (argc=2, argv=0x600ffffffffef388)
>     at ../../gcc/main.c:39
> (gdb) f 5
> #5  0x4000000000b3f4b0 in gcc::pass_manager::pass_manager (
>     this=0x60000000002ea0c0, ctxt=<optimized out>) at ../../gcc/passes.c:1607
> 1607      register_dump_files (all_lowering_passes);
> (gdb) p m_name_to_pass_map
> $13 = (hash_map<nofree_string_hash, opt_pass*, simple_hashmap_traits<default_hash_traits<nofree_string_hash>, opt_pass*> > *) 0x2000000000988140 <_IO_2_1_stderr_>
> 
> Andreas.

I am testing

2017-04-25  Richard Biener  <rguenther@suse.de>

	PR middle-end/80509
	* passes.c (pass_manager::pass_manager): Initialize
	m_name_to_pass_map.
diff mbox

Patch

Index: gcc/passes.c
===================================================================
--- gcc/passes.c	(revision 247147)
+++ gcc/passes.c	(working copy)
@@ -1532,7 +1532,7 @@  pass_manager::pass_manager (context *ctx
 : all_passes (NULL), all_small_ipa_passes (NULL), all_lowering_passes (NULL),
   all_regular_ipa_passes (NULL),
   all_late_ipa_passes (NULL), passes_by_id (NULL), passes_by_id_size (0),
-  m_ctxt (ctxt)
+  m_ctxt (ctxt), m_name_to_pass_map (NULL)
 {
   opt_pass **p;