diff options
author | Tom de Vries <tdevries@suse.de> | 2018-07-07 11:08:27 +0000 |
---|---|---|
committer | Tom de Vries <vries@gcc.gnu.org> | 2018-07-07 11:08:27 +0000 |
commit | bb120fb0fee876759bd9aa849585762420199507 (patch) | |
tree | cbdfe73145dbf5ccb4c97eef25233f4e3f39beae | |
parent | e730a0ef11a788bb00034e007b320c6608c17e66 (diff) | |
download | gcc-bb120fb0fee876759bd9aa849585762420199507.tar.gz |
Fix sigsegv on -fdump-tree-all-enumerate_locals
2018-07-07 Tom de Vries <tdevries@suse.de>
* tree-dfa.c (dump_enumerated_decls): Handle cfun->cfg == NULL.
* gcc.misc-tests/options.exp (check_for_all_options): Clean up dump
files.
(get_dump_flags): New proc.
(toplevel): Test all dump flags.
From-SVN: r262500
-rw-r--r-- | gcc/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/gcc.misc-tests/options.exp | 38 | ||||
-rw-r--r-- | gcc/tree-dfa.c | 3 |
4 files changed, 52 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 986b54f6110..350ebf518c5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2018-07-07 Tom de Vries <tdevries@suse.de> + + * tree-dfa.c (dump_enumerated_decls): Handle cfun->cfg == NULL. + 2018-07-07 Aldy Hernandez <aldyh@redhat.com> * tree-vrp.c (vrp_int_const_binop): Change overflow type to diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1534e922320..04d705d68d2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2018-07-07 Tom de Vries <tdevries@suse.de> + + * gcc.misc-tests/options.exp (check_for_all_options): Clean up dump + files. + (get_dump_flags): New proc. + (toplevel): Test all dump flags. + 2018-07-07 Eric Botcazou <ebotcazou@adacore.com> * gnat.dg/stack_usage6.adb: New test. diff --git a/gcc/testsuite/gcc.misc-tests/options.exp b/gcc/testsuite/gcc.misc-tests/options.exp index 693b40df1fd..faeae705c08 100644 --- a/gcc/testsuite/gcc.misc-tests/options.exp +++ b/gcc/testsuite/gcc.misc-tests/options.exp @@ -52,6 +52,10 @@ proc check_for_all_options {language gcc_options compiler_pattern as_pattern ld_ } set gcc_output [gcc_target_compile $filename.c $filename.x executable $gcc_options] remote_file build delete $filename.c $filename.x $filename.gcno + set dumpfiles [glob -nocomplain $filename.c.*] + foreach dumpfile $dumpfiles { + remote_file build delete $dumpfile + } if {![regexp -- "/${compiler}(\\.exe)? -quiet.*$compiler_pattern" $gcc_output]} { fail "$test (compiler options)" @@ -70,4 +74,38 @@ proc check_for_all_options {language gcc_options compiler_pattern as_pattern ld_ check_for_all_options c {--coverage} {-fprofile-arcs -ftest-coverage} {} {-lgcov} +proc get_dump_flags {} { + set res [list] + + global srcdir + set file "$srcdir/../dumpfile.c" + + set a [open $file] + set lines [split [read $a] "\n"] + close $a + + set domatch 0 + foreach line $lines { + if { [regexp "dump_options.* =" $line] } { + set domatch 1 + } elseif { [regexp "^\};" $line] } { + set domatch 0 + } + if { $domatch } { + if { [regexp "\"(.*)\"" $line match submatch] } { + lappend res $submatch + } + } + } + + return $res +} + +foreach flag [get_dump_flags] { + check_for_all_options c -fdump-tree-all-$flag {} {} {} + check_for_all_options c -fdump-ipa-all-$flag {} {} {} + check_for_all_options c -fdump-rtl-all-$flag {} {} {} + check_for_all_options c -fdump-lang-all-$flag {} {} {} +} + gcc_parallel_test_enable 1 diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c index 00aa75f47ab..ee2ff2958db 100644 --- a/gcc/tree-dfa.c +++ b/gcc/tree-dfa.c @@ -992,6 +992,9 @@ dump_enumerated_decls_push (tree *tp, int *walk_subtrees, void *data) void dump_enumerated_decls (FILE *file, dump_flags_t flags) { + if (!cfun->cfg) + return; + basic_block bb; struct walk_stmt_info wi; auto_vec<numbered_tree, 40> decl_list; |