This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
Patch for the vla-branch to fix unallocated variables
- From: Joost van der Sluis <joost at cnoc dot nl>
- To: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Cc: archer at sourceware dot org
- Date: Tue, 13 Apr 2010 10:04:51 +0200
- Subject: 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