public inbox for archer@sourceware.org
 help / color / mirror / Atom feed
From: Joost van der Sluis <joost@cnoc.nl>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: archer@sourceware.org
Subject: Patch for the vla-branch to fix unallocated variables
Date: Tue, 13 Apr 2010 08:05:00 -0000	[thread overview]
Message-ID: <1271145891.1367.4.camel@wsjoost.cnoc.lan> (raw)

[-- 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

             reply	other threads:[~2010-04-13  8:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-13  8:05 Joost van der Sluis [this message]
2010-04-16 10:08 ` Jan Kratochvil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1271145891.1367.4.camel@wsjoost.cnoc.lan \
    --to=joost@cnoc.nl \
    --cc=archer@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).