public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix IPA modref ubsan.
@ 2021-11-18 12:35 Martin Liška
  2021-11-18 12:41 ` Jan Hubicka
  0 siblings, 1 reply; 7+ messages in thread
From: Martin Liška @ 2021-11-18 12:35 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jan Hubicka

modref_tree<tree_node*>::merge(modref_tree<tree_node*>*, vec<modref_parm_map, va_heap, vl_ptr>*, modref_parm_map*, bool)

is called with modref_parm_map chain_map;

The variable has uninitialized m.parm_offset_known and it is accessed
here:

gcc/ipa-modref-tree.h:572 a.parm_offset_known &= m.parm_offset_known;

Ready to be installed after testing?
Thanks,
Martin

	PR ipa/103230

gcc/ChangeLog:

	* ipa-modref-tree.h (struct modref_parm_map): Add default
	constructor.
	* ipa-modref.c (ipa_merge_modref_summary_after_inlining): Use it.
---
  gcc/ipa-modref-tree.h | 5 +++++
  gcc/ipa-modref.c      | 3 +--
  2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/gcc/ipa-modref-tree.h b/gcc/ipa-modref-tree.h
index 0a097349ebd..6796e6ecc34 100644
--- a/gcc/ipa-modref-tree.h
+++ b/gcc/ipa-modref-tree.h
@@ -287,6 +287,11 @@ struct GTY((user)) modref_base_node
  
  struct modref_parm_map
  {
+  /* Default constructor.  */
+  modref_parm_map ()
+  : parm_index (MODREF_UNKNOWN_PARM), parm_offset_known (false), parm_offset ()
+  {}
+
    /* Index of parameter we translate to.
       Values from special_params enum are permitted too.  */
    int parm_index;
diff --git a/gcc/ipa-modref.c b/gcc/ipa-modref.c
index c94f0589d44..630d202d5cf 100644
--- a/gcc/ipa-modref.c
+++ b/gcc/ipa-modref.c
@@ -5020,8 +5020,7 @@ ipa_merge_modref_summary_after_inlining (cgraph_edge *edge)
        auto_vec <modref_parm_map, 32> parm_map;
        modref_parm_map chain_map;
        /* TODO: Once we get jump functions for static chains we could
-	 compute this.  */
-      chain_map.parm_index = MODREF_UNKNOWN_PARM;
+	 compute parm_index.  */
  
        compute_parm_map (edge, &parm_map);
  
-- 
2.33.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-11-19 16:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-18 12:35 [PATCH] Fix IPA modref ubsan Martin Liška
2021-11-18 12:41 ` Jan Hubicka
2021-11-18 15:48   ` Martin Sebor
2021-11-18 16:22     ` Jan Hubicka
2021-11-18 16:54       ` Martin Sebor
2021-11-18 17:10         ` Jan Hubicka
2021-11-19 16:10           ` Martin Sebor

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