Hi,
this patch fixes two uninitialized memory uses in ipa-modref.  First is
harmless because the values are never used, but they will make valgrind
unhapy.
Second is an actual bug: while breaking the patch in half I forgot to
initialize errno at stream in time.

Bootstrapped/regtested x86_64-linux, comitted.

        * ipa-modref.c (parm_map_for_arg): Initialize parm_offset and
        parm_offset_knonw.
        (read_section): Set writes_errno to false.
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

Reply via email to