public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/marxin/heads/PR103230-fix-ubsan-in-modref)] Fix IPA modref ubsan.
@ 2021-11-18 12:18 Martin Liska
0 siblings, 0 replies; only message in thread
From: Martin Liska @ 2021-11-18 12:18 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:38ae20071bbe572a6c808a48609f53011fcdb332
commit 38ae20071bbe572a6c808a48609f53011fcdb332
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 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);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-11-18 12:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-18 12:18 [gcc(refs/users/marxin/heads/PR103230-fix-ubsan-in-modref)] Fix IPA modref ubsan Martin Liska
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).