public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Martin Liska <marxin@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-5399] Fix IPA modref ubsan.
Date: Fri, 19 Nov 2021 11:33:37 +0000 (GMT)	[thread overview]
Message-ID: <20211119113337.C440C3858C39@sourceware.org> (raw)

https://gcc.gnu.org/g:74a4ece02df1b1b6f396fd0e24dbbf8b0897858a

commit r12-5399-g74a4ece02df1b1b6f396fd0e24dbbf8b0897858a
Author: Martin Liska <mliska@suse.cz>
Date:   Thu Nov 18 13:14:25 2021 +0100

    Fix IPA modref ubsan.
    
    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;
    
            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.

Diff:
---
 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 213343173c5..57e2aa5d868 100644
--- a/gcc/ipa-modref.c
+++ b/gcc/ipa-modref.c
@@ -5030,8 +5030,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);


                 reply	other threads:[~2021-11-19 11:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211119113337.C440C3858C39@sourceware.org \
    --to=marxin@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).