This is the mail archive of the archer@sourceware.org mailing list for the Archer 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 for the vla-branch to fix unallocated variables


Hello Jan,

I've encountered a bug in the vla-branch. A patch is attached. The
problem is that when the bounds of an array are determined, the check if
the type is allocated at all is incorrect. 

The 'TYPE_NOT_ALLOCATED' of 'type' is checked. But in the case that
type_not_allocated is a dwarf-block expression, the result is only set
to new_type.

(this results in an invalid memory access)

Regards,

Joost van der Sluis 
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 2ab2382..333a28e 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -3322,8 +3322,8 @@ copy_type_recursive_1 (struct objfile *objfile,
 	{
 	  /* `struct dwarf2_locexpr_baton' is too bound to its objfile so
 	     it is expected to be made constant by CHECK_TYPEDEF.  */
-	  if (TYPE_NOT_ALLOCATED (type)
-	      || TYPE_NOT_ASSOCIATED (type))
+	  if (TYPE_NOT_ALLOCATED (new_type)
+	      || TYPE_NOT_ASSOCIATED (new_type))
 	    TYPE_RANGE_DATA (new_type)->low.u.dwarf_block = NULL;
 	  else
 	    TYPE_LOW_BOUND (new_type) = dwarf_locexpr_baton_eval
@@ -3335,8 +3335,8 @@ copy_type_recursive_1 (struct objfile *objfile,
 	{
 	  /* `struct dwarf2_locexpr_baton' is too bound to its objfile so
 	     it is expected to be made constant by CHECK_TYPEDEF.  */
-	  if (TYPE_NOT_ALLOCATED (type)
-	      || TYPE_NOT_ASSOCIATED (type))
+	  if (TYPE_NOT_ALLOCATED (new_type)
+	      || TYPE_NOT_ASSOCIATED (new_type))
 	    TYPE_RANGE_DATA (new_type)->high.u.dwarf_block = NULL;
 	  else
 	    TYPE_HIGH_BOUND (new_type) = dwarf_locexpr_baton_eval

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