From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 7qsxHWH3tl9YUgAAWB0awg (envelope-from ) for ; Thu, 19 Nov 2020 17:53:21 -0500 Received: by simark.ca (Postfix, from userid 112) id 6AC261F08B; Thu, 19 Nov 2020 17:53:21 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 89E1B1E58E for ; Thu, 19 Nov 2020 17:53:20 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 97C6F384A882; Thu, 19 Nov 2020 22:53:19 +0000 (GMT) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id 23E44385141D for ; Thu, 19 Nov 2020 22:53:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 23E44385141D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tdevries@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 14242AC2E; Thu, 19 Nov 2020 22:53:16 +0000 (UTC) Subject: Re: [PATCH] KFAIL variable-length array tests which fail with Clang To: Tom Tromey , Gary Benson via Gdb-patches References: <1605547055-25778-1-git-send-email-gbenson@redhat.com> <87mtzek5fv.fsf@tromey.com> From: Tom de Vries Message-ID: <0a3f590c-2a76-e470-136f-e8f88aef1d17@suse.de> Date: Thu, 19 Nov 2020 23:53:15 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <87mtzek5fv.fsf@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" On 11/18/20 5:14 PM, Tom Tromey wrote: >>>>>> "Gary" == Gary Benson via Gdb-patches writes: > > Gary> Clang describes the upper bounds of variable length arrays using > Gary> a DW_AT_count attribute which references the DIE of a synthetic > Gary> variable whose value is specified using a DW_AT_location. In > Gary> some cases GDB correctly handles these, but in other cases GDB > Gary> adds an extra dereference causing the test to fail. This commit > Gary> marks these failing tests as caused by PR gdb/26905 when the > Gary> test executable was built using Clang. > > Shouldn't we just fix the gdb bug instead? This adhoc patch: ... diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 3c598262913..d27e8613d1c 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -18644,7 +18644,9 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die _info *die, struct dwarf_block *block = target_attr->as_block (); baton->locexpr.size = block->size; baton->locexpr.data = block->data; - baton->locexpr.is_reference = true; + gdb_byte last = block->data[block->size - 1]; + baton->locexpr.is_reference + = !(last == DW_OP_stack_value || last == DW_OP_implicit_value); prop->set_locexpr (baton); gdb_assert (prop->baton () != NULL); } ... fixes gdb.base/vla-optimized-out.exp with clang-10 for me. Thanks, - Tom > Or is there something preventing that? I feel like I may not fully > appreciate the problem. > > Tom >