public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ibm/heads/perf)] pass_manager: Fix ICE with -fdump-passes -fdisable-tree-* [PR93874]
@ 2020-03-19  5:51 Jiu Fu Guo
  0 siblings, 0 replies; only message in thread
From: Jiu Fu Guo @ 2020-03-19  5:51 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:2473c81cb2d4627f2d72310f4eca951c6084b596

commit 2473c81cb2d4627f2d72310f4eca951c6084b596
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Feb 25 10:21:34 2020 +0100

    pass_manager: Fix ICE with -fdump-passes -fdisable-tree-* [PR93874]
    
    dump_passes pushes a dummy function for which it evaluates the gates
    and checks whether the pass is enabled or disabled.
    Unfortunately, if any -fdisable-*-*/-fenable-*-* options were seen,
    we ICE during is_pass_explicitly_enabled_or_disabled because slot
    is non-NULL then and the code will do:
      cgraph_uid = func ? cgraph_node::get (func)->get_uid () : 0;
    but the dummy function doesn't have a cgraph node.
    
    So, either we need to create and then remove a cgraph node for the dummy
    function like the following patch, or function.c would need to export the
    in_dummy_function flag (or have some way to query that flag from other TUs)
    and we'd need to check it in is_pass_explicitly_enabled_or_disabled.
    
    2020-02-25  Jakub Jelinek  <jakub@redhat.com>
    
            PR middle-end/93874
            * passes.c (pass_manager::dump_passes): Create a cgraph node for the
            dummy function and remove it at the end.
    
            * gcc.dg/pr93874.c: New test.

Diff:
---
 gcc/ChangeLog                  | 4 ++++
 gcc/passes.c                   | 2 ++
 gcc/testsuite/ChangeLog        | 3 +++
 gcc/testsuite/gcc.dg/pr93874.c | 6 ++++++
 4 files changed, 15 insertions(+)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 0d6cf71cb04..9d453f16f07 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,9 @@
 2020-02-25  Jakub Jelinek  <jakub@redhat.com>
 
+	PR middle-end/93874
+	* passes.c (pass_manager::dump_passes): Create a cgraph node for the
+	dummy function and remove it at the end.
+
 	PR translation/93864
 	* config/lm32/lm32.c (lm32_setup_incoming_varargs): Fix comment typo
 	paramter -> parameter.
diff --git a/gcc/passes.c b/gcc/passes.c
index fd2684fc0b3..07b2613ffea 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -950,6 +950,7 @@ void
 pass_manager::dump_passes () const
 {
   push_dummy_function (true);
+  cgraph_node *node = cgraph_node::get_create (current_function_decl);
 
   create_pass_tab ();
 
@@ -959,6 +960,7 @@ pass_manager::dump_passes () const
   dump_pass_list (all_late_ipa_passes, 1);
   dump_pass_list (all_passes, 1);
 
+  node->remove ();
   pop_dummy_function ();
 }
 
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 153e4ee10e7..62b000b2314 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,8 @@
 2020-02-25  Jakub Jelinek  <jakub@redhat.com>
 
+	PR middle-end/93874
+	* gcc.dg/pr93874.c: New test.
+
 	PR ipa/93763
 	* gcc.dg/ipa/pr93763.c: Adjust the test so that it compiles without
 	warnings and still ICEs before the ipa-cp.c fix.
diff --git a/gcc/testsuite/gcc.dg/pr93874.c b/gcc/testsuite/gcc.dg/pr93874.c
new file mode 100644
index 00000000000..154ef50ea54
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr93874.c
@@ -0,0 +1,6 @@
+/* PR middle-end/93874 */
+/* { dg-do compile } */
+/* { dg-options "-fdisable-tree-dse3 -fdump-passes" } */
+/* { dg-prune-output ".*" } */
+
+int i;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-03-19  5:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-19  5:51 [gcc(refs/vendors/ibm/heads/perf)] pass_manager: Fix ICE with -fdump-passes -fdisable-tree-* [PR93874] Jiu Fu Guo

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).