From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26883 invoked by alias); 13 Apr 2010 08:05:21 -0000 Mailing-List: contact archer-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: List-Id: Received: (qmail 26753 invoked by uid 22791); 13 Apr 2010 08:05:19 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW,TW_BJ X-Spam-Check-By: sourceware.org Subject: Patch for the vla-branch to fix unallocated variables From: Joost van der Sluis To: Jan Kratochvil Cc: archer@sourceware.org Content-Type: multipart/mixed; boundary="=-pRUeVpedJeYx0HpjMmbb" Date: Tue, 13 Apr 2010 08:05:00 -0000 Message-Id: <1271145891.1367.4.camel@wsjoost.cnoc.lan> Mime-Version: 1.0 X-Spam-Scanned: InterNLnet Mail Scan System V2.03 X-SW-Source: 2010-q2/txt/msg00010.txt.bz2 --=-pRUeVpedJeYx0HpjMmbb Content-Type: text/plain Content-Transfer-Encoding: 7bit Content-length: 425 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 --=-pRUeVpedJeYx0HpjMmbb Content-Disposition: attachment; filename="allocated_associated_patch.diff" Content-Type: text/x-patch; name="allocated_associated_patch.diff"; charset="UTF-8" Content-Transfer-Encoding: 7bit Content-length: 1095 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 --=-pRUeVpedJeYx0HpjMmbb--