From ea937e7d8730b4faa18bc67413dbb14567be7390 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Thu, 5 Nov 2020 15:25:14 +0100 Subject: [PATCH] Fix uninitialized memory use in ipa-modref * ipa-modref.c (parm_map_for_arg): Initialize parm_offset and parm_offset_knonw. (read_section): Set writes_errno to false. --- gcc/ipa-modref.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/ipa-modref.c b/gcc/ipa-modref.c index b40f3da3ba2..9df3d2bcf2d 100644 --- a/gcc/ipa-modref.c +++ b/gcc/ipa-modref.c @@ -525,6 +525,9 @@ parm_map_for_arg (gimple *stmt, int i) poly_int64 offset; struct modref_parm_map parm_map; + parm_map.parm_offset_known = false; + parm_map.parm_offset = 0; + offset_known = unadjusted_ptr_and_unit_offset (op, &op, &offset); if (TREE_CODE (op) == SSA_NAME && SSA_NAME_IS_DEFAULT_DEF (op) @@ -1533,10 +1536,12 @@ read_section (struct lto_file_decl_data *file_data, const char *data, modref_summary_lto *modref_sum_lto = summaries_lto ? summaries_lto->get_create (node) : NULL; - if (optimization_summaries) modref_sum = optimization_summaries->get_create (node); + if (modref_sum) + modref_sum->writes_errno = false; + gcc_assert (!modref_sum || (!modref_sum->loads && !modref_sum->stores)); gcc_assert (!modref_sum_lto || (!modref_sum_lto->loads -- 2.30.2