Fix uninitialized memory use in ipa-modref
authorJan Hubicka <jh@suse.cz>
Thu, 5 Nov 2020 14:25:14 +0000 (15:25 +0100)
committerJan Hubicka <jh@suse.cz>
Thu, 5 Nov 2020 14:25:14 +0000 (15:25 +0100)
* 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

index b40f3da3ba2b0debc84c72168da234322b182981..9df3d2bcf2d2b1e150174be8ebb446e4a531ff64 100644 (file)
@@ -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