public inbox for archer@sourceware.org
 help / color / mirror / Atom feed
* Patch for the vla-branch to fix unallocated variables
@ 2010-04-13  8:05 Joost van der Sluis
  2010-04-16 10:08 ` Jan Kratochvil
  0 siblings, 1 reply; 2+ messages in thread
From: Joost van der Sluis @ 2010-04-13  8:05 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: archer

[-- Attachment #1: Type: text/plain, Size: 425 bytes --]

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 

[-- Attachment #2: allocated_associated_patch.diff --]
[-- Type: text/x-patch, Size: 1095 bytes --]

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Patch for the vla-branch to fix unallocated variables
  2010-04-13  8:05 Patch for the vla-branch to fix unallocated variables Joost van der Sluis
@ 2010-04-16 10:08 ` Jan Kratochvil
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Kratochvil @ 2010-04-16 10:08 UTC (permalink / raw)
  To: Joost van der Sluis; +Cc: archer

Hi Joost,

On Tue, 13 Apr 2010 10:04:51 +0200, Joost van der Sluis wrote:
> 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. 

yes, nice catch, checked-in a patch based on yours as:
	3196f2b8da1570a72feaecc52231b469226ec779


Thanks,
Jan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-04-16 10:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-13  8:05 Patch for the vla-branch to fix unallocated variables Joost van der Sluis
2010-04-16 10:08 ` Jan Kratochvil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).