Bug 97235 - [11 Regression] ICE in duplicate, at ipa-prop.c:4251 since r11-3478-gada353b87909fd6c
Summary: [11 Regression] ICE in duplicate, at ipa-prop.c:4251 since r11-3478-gada353b8...
Status: RESOLVED DUPLICATE of bug 97244
Alias: None
Product: gcc
Classification: Unclassified
Component: ipa (show other bugs)
Version: 11.0
: P1 normal
Target Milestone: 11.0
Assignee: Jan Hubicka
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2020-09-29 01:36 UTC by Arseny Solokha
Modified: 2020-10-01 13:14 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail: 11.0
Last reconfirmed: 2020-09-29 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arseny Solokha 2020-09-29 01:36:29 UTC
gcc-11.0.0-alpha20200927 snapshot (g:e24817aa7a1c6d12039b486ab5ea9b5ee0a46cd4) ICEs when compiling the following testcase w/ -O2 -fno-ipa-modref:

struct ie {
  int hk;
};

typedef int
gn (int, struct ie *);

int
de (int, struct ie *);

int
qc (int, struct ie *);

int bh;

int
uj (gn yz)
{
  struct ie *se = 0;

  if (se->hk == 1)
    return yz (bh, se);

  return 1;
}

int
n6 (void)
{
  (void) uj (qc);
  (void) uj (de);
}

% gcc-11.0.0 -O2 -fno-ipa-modref -c a7m1ghpt.c
during IPA pass: inline
a7m1ghpt.c: In function 'n6':
a7m1ghpt.c:31:10: internal compiler error: in duplicate, at ipa-prop.c:4251
   31 |   (void) uj (de);
      |          ^~~~~~~
0x6741de ipa_edge_args_sum_t::duplicate(cgraph_edge*, cgraph_edge*, ipa_edge_args*, ipa_edge_args*)
	/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200927/work/gcc-11-20200927/gcc/ipa-prop.c:4251
0x95912b symbol_table::call_edge_duplication_hooks(cgraph_edge*, cgraph_edge*)
	/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200927/work/gcc-11-20200927/gcc/cgraph.c:451
0x96d12f cgraph_edge::clone(cgraph_node*, gcall*, unsigned int, profile_count, profile_count, bool)
	/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200927/work/gcc-11-20200927/gcc/cgraphclones.c:149
0xe322d7 copy_bb
	/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200927/work/gcc-11-20200927/gcc/tree-inline.c:2266
0xe332fb copy_cfg_body
	/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200927/work/gcc-11-20200927/gcc/tree-inline.c:3042
0xe332fb copy_body
	/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200927/work/gcc-11-20200927/gcc/tree-inline.c:3290
0xe36714 expand_call_inline
	/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200927/work/gcc-11-20200927/gcc/tree-inline.c:5076
0xe38391 gimple_expand_calls_inline
	/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200927/work/gcc-11-20200927/gcc/tree-inline.c:5266
0xe38391 optimize_inline_calls(tree_node*)
	/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200927/work/gcc-11-20200927/gcc/tree-inline.c:5439
0xb92863 inline_transform(cgraph_node*)
	/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200927/work/gcc-11-20200927/gcc/ipa-inline-transform.c:741
0xccd67d execute_one_ipa_transform_pass
	/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200927/work/gcc-11-20200927/gcc/passes.c:2240
0xccd67d execute_all_ipa_transforms(bool)
	/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200927/work/gcc-11-20200927/gcc/passes.c:2279
0x968683 cgraph_node::expand()
	/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200927/work/gcc-11-20200927/gcc/cgraphunit.c:2302
0x969c1d expand_all_functions
	/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200927/work/gcc-11-20200927/gcc/cgraphunit.c:2480
0x969c1d symbol_table::compile()
	/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200927/work/gcc-11-20200927/gcc/cgraphunit.c:2843
0x96c092 symbol_table::compile()
	/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200927/work/gcc-11-20200927/gcc/cgraphunit.c:2756
0x96c092 symbol_table::finalize_compilation_unit()
	/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200927/work/gcc-11-20200927/gcc/cgraphunit.c:3021
Comment 1 Martin Liška 2020-09-29 08:12:19 UTC
Confirmed, started with r11-3478-gada353b87909fd6c.
Comment 2 Jan Hubicka 2020-09-30 15:43:39 UTC
I am testing this fix. Problem is that when modref is disabled we never
relase ipa-prop datastructures.

2020-09-30  Jan Hubicka  <hubicka@ucw.cz>

	* ipa-fnsummary.c: (pass_free_fnsummary:execute): Call	
	ipa_free_all_structures_after_iinln.
	* ipa-modref.c (pass_ipa_modref::execute): Do not call
	ipa_free_all_structures_after_iinln.
	* ipa-prop.c (ipa_free_all_node_params): Do not crash if info
	is not allocated.
	(ipa_unregister_cgraph_hooks): Likewise.


diff --git a/gcc/ipa-fnsummary.c b/gcc/ipa-fnsummary.c
index 4c1c1f91482..8285cc00d33 100644
--- a/gcc/ipa-fnsummary.c
+++ b/gcc/ipa-fnsummary.c
@@ -4680,6 +4680,8 @@ public:
   virtual unsigned int execute (function *)
     {
       ipa_free_fn_summary ();
+      /* Free ipa-prop structures if they are no longer needed.  */
+      ipa_free_all_structures_after_iinln ();
       if (!flag_wpa)
 	ipa_free_size_summary ();
       return 0;
diff --git a/gcc/ipa-modref.c b/gcc/ipa-modref.c
index 6225552e41a..2f4da8f2a14 100644
--- a/gcc/ipa-modref.c
+++ b/gcc/ipa-modref.c
@@ -1681,8 +1681,6 @@ pass_ipa_modref::execute (function *)
     }
   ((modref_summaries *)summaries)->ipa = false;
   ipa_free_postorder_info ();
-  /* Free ipa-prop structures if they are no longer needed.  */
-  ipa_free_all_structures_after_iinln ();
   return 0;
 }
 
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index b28c78eeab4..ea88fd3fd95 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -4124,7 +4124,8 @@ ipa_free_all_edge_args (void)
 void
 ipa_free_all_node_params (void)
 {
-  ggc_delete (ipa_node_params_sum);
+  if (ipa_node_params_sum)
+    ggc_delete (ipa_node_params_sum);
   ipa_node_params_sum = NULL;
 }
 
@@ -4368,7 +4369,8 @@ ipa_register_cgraph_hooks (void)
 static void
 ipa_unregister_cgraph_hooks (void)
 {
-  symtab->remove_cgraph_insertion_hook (function_insertion_hook_holder);
+  if (function_insertion_hook_holder)
+    symtab->remove_cgraph_insertion_hook (function_insertion_hook_holder);
   function_insertion_hook_holder = NULL;
 }
Comment 3 Jan Hubicka 2020-10-01 13:14:49 UTC
This is the same issues at 97244

*** This bug has been marked as a duplicate of bug 97244 ***