From patchwork Mon Feb 12 12:47:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rohr, Stephan" X-Patchwork-Id: 85593 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7332E3858409 for ; Mon, 12 Feb 2024 12:48:16 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by sourceware.org (Postfix) with ESMTPS id 8244E3858D32 for ; Mon, 12 Feb 2024 12:47:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8244E3858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8244E3858D32 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=198.175.65.10 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707742072; cv=none; b=M4k03aPnPqFiWaIeOgVv6Tws+wxmnB6F4ZWE5nu/VCH5BKsQTHjIJHuPgzUxgiSMzAQ1QDFfvDkWqD03eHLCyYC7tCiHxb6XPZrgvg+tI+RmpVpb7Y4YYjSLPBYYCMHQL5/HxjNIDA74VzHTDKFKE2UfaSBSskCZdc8yztYrNBo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707742072; c=relaxed/simple; bh=kcZxHixxk3fimUoWc2xZ8qoq+MZUeyfAUxHMadyxg3Q=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=natu0vDTXrxqGDdXYXB9EVY+WchJa9kKTjdFcQUc2+MxIWjUSKm4ObeJg4sIpc4I7cnD8lTOwOVHb35wXDwkSDhblD0W1wusNnZZ8BINgZkv5PDCOm4F6N1tC1VeNrSC24IqzMHoAYrgP4G97UMc4xPzV78LSGtvOsKxW2svglg= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1707742071; x=1739278071; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=kcZxHixxk3fimUoWc2xZ8qoq+MZUeyfAUxHMadyxg3Q=; b=N7ep9h4RMPez9x8+jTMrIEPTA65KXe1Wu/IhNzgL3+jWkDJZS3NYU3HP q3l3Nz0o6Gqqr5P5ZmpEoPxeCPjh/lRUkcPWPavxD24qwT//A0n9xL+ea pZeriYNEafzXheBBS96buNyhng6saBxCcVk8URECQ3ej5fhwsfKgWKFft 2uupO19mJNa1w/zOgHRiXxJ/oX8dvWkrMxfTc7XpU9+Ok3HkwEFD/xC/5 FAq4kjgePJ5Kdp8oct4NRUk9vibAuyDLG+D3aJoJNjCv3JRTBU7Z+E/cN lXxQ5i53t5HixhO6V1/Z/x3wS3ugoVT2D4s5egNk+RQX2CGeBJjY91mp8 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10981"; a="19128226" X-IronPort-AV: E=Sophos;i="6.06,263,1705392000"; d="scan'208";a="19128226" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Feb 2024 04:47:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,263,1705392000"; d="scan'208";a="2583798" Received: from 984fee0031af.jf.intel.com (HELO localhost) ([10.165.54.65]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Feb 2024 04:47:51 -0800 From: Stephan Rohr To: gdb-patches@sourceware.org Subject: [PATCH 1/1] gdb: Fix assertion in 'value_primitive_field' Date: Mon, 12 Feb 2024 04:47:40 -0800 Message-Id: <20240212124740.2734613-2-stephan.rohr@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240212124740.2734613-1-stephan.rohr@intel.com> References: <20240212124740.2734613-1-stephan.rohr@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org From: "Rohr, Stephan" GDB asserts that the data location of a value's field with a dynamic data location is resolved when fetching the field's value in 'value_primitive_field'. This assertion was hit because of bogus DWARF generated by the Intel Fortran compiler. While that compiler should fix the DWARF, we prefer GDB to error out here instead, e.g. to allow the user to continue debugging other parts of the program. --- gdb/value.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gdb/value.c b/gdb/value.c index 8840aa41a33..a67e696ae4f 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -3056,7 +3056,9 @@ value::primitive_field (LONGEST offset, int fieldno, struct type *arg_type) gdb_assert (0 == offset); /* We expect an already resolved data location. */ - gdb_assert (TYPE_DATA_LOCATION (type)->is_constant ()); + if (PROP_CONST != TYPE_DATA_LOCATION_KIND (type)) + error (_("cannot read %s, expected an already resolved data " + "location."), arg_type->field (fieldno).name ()); /* For dynamic data types defer memory allocation until we actual access the value. */ v = value::allocate_lazy (type);