From patchwork Mon Jul 4 07:52:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 55683 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 D5D2C39730E2 for ; Mon, 4 Jul 2022 07:56:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D5D2C39730E2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1656921366; bh=4V7hWQL1qdpa++DHREGUJIWsmnrLoOw7l38m/I5eCZo=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=d6ashSR/zIOOCwqnEggmqp8pUoX7BRprfy0S4+sHPtb7nsNeTeoMk1lrfNwcHDgpO sGkLMgnWtt4epx2XD8jOuJj7Kpe0BtqoviXuOHr89nPbVSj1VDCIVmfG7Tc8NcK93H ITLXcGne7vb/3OI/Vo22wUgQrYshf8w8J5zL9fl4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by sourceware.org (Postfix) with ESMTPS id 4E04D3895FC9 for ; Mon, 4 Jul 2022 07:52:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4E04D3895FC9 Received: by mail-wr1-x434.google.com with SMTP id v16so765247wrd.13 for ; Mon, 04 Jul 2022 00:52:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=4V7hWQL1qdpa++DHREGUJIWsmnrLoOw7l38m/I5eCZo=; b=tkOJTkI+1kmlsEkt0lgdgi7w4+5HG5e46MsXBJFErW+Dm5+69V1P0mbiuOFiiLenak TzLKPXZ8hksH4RVtgIXR9m6qKW9D/hqkbnwhWSsau1dhKeFT3J9wcsIr0WVQOCwyPRTo 9CYwQgxzViXXumJY/Fj3Cpu+VvhhZXpbvJH8r9eEMKZjk6eIn6DLsq9GKwGuNu29vdcC W8xtEKGjO3coy5dOefFbYREsGIvTzx3/AzvDPZ7+HoNZQ04q6WSMDbqObV/1zB4sU9rb JNoc7G8BCkWg2Czw7LoDnTOnVKg7VFWv7mCAEK6Om8gh2P0C+CV7DFNzVuuv3zQJmHPV HJVA== X-Gm-Message-State: AJIora/hF1OzwK6HH1SHu+mVvjAdNXSRsPzz1Dsn28ziLNyWv6MqKr45 f34bKYMBTE09DD+hbEuc8WT/eD4BeWwYWg== X-Google-Smtp-Source: AGRyM1so5Y16bJknMwdo+ljfP+/z0eDmXCTQL4GrM+9TTA0ZmsiwSk6mz/2CNWodKvBcPmNJwrz17Q== X-Received: by 2002:a05:6000:1869:b0:21b:933c:7e2 with SMTP id d9-20020a056000186900b0021b933c07e2mr27072304wri.252.1656921143115; Mon, 04 Jul 2022 00:52:23 -0700 (PDT) Received: from fomalhaut.localnet ([2a01:e0a:8d5:d990:e654:e8ff:fe8f:2ce6]) by smtp.gmail.com with ESMTPSA id c8-20020a05600c0a4800b003a02f957245sm13086053wmq.26.2022.07.04.00.52.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jul 2022 00:52:22 -0700 (PDT) X-Google-Original-From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [PATCH] Use default lower bound for vector types in debug info Date: Mon, 04 Jul 2022 09:52:21 +0200 Message-ID: <4409263.LvFx2qVVIh@fomalhaut> MIME-Version: 1.0 X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Eric Botcazou via Gcc-patches From: Eric Botcazou Reply-To: Eric Botcazou Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi, vector types are represented as array types with DW_AT_GNU_vector attribute in the debug info and a range [0 .. TYPE_VECTOR_SUBPARTS - 1]. That's obviously skewed toward the C family of languages, therefore the attached patch changes the lower bound to the default for the language of the CU, if any. Tested on x86-64/Linux, OK for the mainline? gcc/ * dwarf2out.cc (gen_array_type_die): Use the default lower bound of the language for vector types. diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc index b468a4b9c0f..149aeaf1a55 100644 --- a/gcc/dwarf2out.cc +++ b/gcc/dwarf2out.cc @@ -22539,11 +22539,14 @@ gen_array_type_die (tree type, dw_die_ref context_die) if (TREE_CODE (type) == VECTOR_TYPE) { - /* For VECTOR_TYPEs we use an array die with appropriate bounds. */ + /* For VECTOR_TYPEs we use an array DIE with appropriate bounds. */ + int lb = lower_bound_default (); + if (lb == -1) + lb = 0; dw_die_ref subrange_die = new_die (DW_TAG_subrange_type, array_die, NULL); - add_bound_info (subrange_die, DW_AT_lower_bound, size_zero_node, NULL); + add_bound_info (subrange_die, DW_AT_lower_bound, size_int (lb), NULL); add_bound_info (subrange_die, DW_AT_upper_bound, - size_int (TYPE_VECTOR_SUBPARTS (type) - 1), NULL); + size_int (lb + TYPE_VECTOR_SUBPARTS (type) - 1), NULL); } else add_subscript_info (array_die, type, collapse_nested_arrays);