This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, Fortran, pr79335, v1] [7 Regression] Conditional jump or move depends on uninitialised in value get_scalar_to_descriptor_type(tree_node*, symbol_attribute) (trans-expr.c:53)


Hi all,

attached patch fixes the access of uninitialized data. Thanks Martin for
analyzing this so far. The symbol_attributes on the stack was used
without initializing it from the symbol's attributes.

Bootstraps and regstests ok on x86_64-linux-gnu/f25. Ok for trunk?

Regards,
	Andre
-- 
Andre Vehreschild * Email: vehre ad gmx dot de 

Attachment: pr79335_v1.clog
Description: Text document

diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 3e54e80..41b36a5 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -5128,6 +5128,16 @@ generate_coarray_sym_init (gfc_symbol *sym)
   else
     reg_type = GFC_CAF_COARRAY_STATIC;
 
+  /* Compile the symbol attribute.  */
+  if (sym->ts.type == BT_CLASS)
+    {
+      attr = CLASS_DATA (sym)->attr;
+      /* The pointer attribute is always set on classes, overwrite it with the
+	 class_pointer attribute, which denotes the pointer for classes.  */
+      attr.pointer = attr.class_pointer;
+    }
+  else
+    attr = sym->attr;
   gfc_init_se (&se, NULL);
   desc = gfc_conv_scalar_to_descriptor (&se, decl, attr);
   gfc_add_block_to_block (&caf_init_block, &se.pre);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]