From patchwork Thu Oct 3 16:38:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 1992431 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=QadY3eGM; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XKHSt6qzDz1xsn for ; Fri, 4 Oct 2024 02:39:25 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 88B8C3845BE1 for ; Thu, 3 Oct 2024 16:39:23 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-io1-xd36.google.com (mail-io1-xd36.google.com [IPv6:2607:f8b0:4864:20::d36]) by sourceware.org (Postfix) with ESMTPS id 353AC3846422 for ; Thu, 3 Oct 2024 16:39:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 353AC3846422 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 353AC3846422 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::d36 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727973542; cv=none; b=eexKbCPbdhGktD27Z/uZQdq+saqSzcpOSa4LXXpBsP5Y562evIHMz9G31L0gpSE/B72PqbVw/S+YBTsUQvm8/XwC0LtyLsN3wOvD0MgyS+Xn4AouKmUx4Of2b/bUkloWmiFG3ijsxOdJ498dP8u3q8Tpy1EVaI3Hz51rYVZR0sM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727973542; c=relaxed/simple; bh=WOdNb4UHEjZVVfyhuNDABzDlRBOkxmLaonKGKrgf7Vo=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=grp68wxMYW18CiLcsKWRD85mPws5QLWhKB3IxjgFLRkygmI3wF0ssW7VoG+EZMwNqErZswsMvVcgcAO6Eq0h477+Hf1Uwi0MHvmWQrqBZwDtW2GDLrVrPk3cCm8+vYTpgaCdZd6kfjaQwiRUSdADTgVlrzv7OSSamiG2n+7uJAQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-io1-xd36.google.com with SMTP id ca18e2360f4ac-82aa7c3b482so47338039f.2 for ; Thu, 03 Oct 2024 09:39:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1727973539; x=1728578339; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=X/ssNc8mZK79Km1YfQmRsJ5ij8uhoAhWnIY1jobCQP0=; b=QadY3eGMYQs9yOqce92PaIXOkHkZ83M0hlhRUSNRCtJd3MOvPrhqS0qD4MhIyy5Zp3 /hueg9/qK6bMt11SLu/N1Ib2N5o/b4mkHWuQMi69fcnh/bzuOPruFH9Iv0O6afS85yDu ASm9bfQsi0AAnLSmL3a5hTk43Ll2R36xl9JQuWpBYXYDEJzvWgflxJO4+gsfeRK95aeA SpCIGB1X6ooM9QzNam1FMbWjJw/u0shqC2R7qnWXgSqqHltzxIAurFbsBN9SWCrDCZfQ WOTsWfCTZikygugja+1FH6dOG4SimBsEmhdRjqIiMrx24xAapqO/3ujevlClcJ9HtAD3 G3wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727973539; x=1728578339; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=X/ssNc8mZK79Km1YfQmRsJ5ij8uhoAhWnIY1jobCQP0=; b=aqBZ2sx4aYAPcjw0b2GAtS5sfGKfnwDKx/XwOqFT2LEBPv2PlBVShhHJAPQ6ksknBd azi2JrJ3hvc+rCBat3FsqSuXbeLoUbrQJZXd9T8mhupqtt3XM9oTEtcBpu/M1z5mLh5c cVFYaYbrCunYb0jykBjAeaSKbm2vAt/aT/dCuARShbcT4WxbRirsbwB+O2Dg3pkfc4uQ dbVRclAiiHhhRQbDaPBueLgFys+/HoXlcK7FVL3kWSkYwuFIgvvUzhjksHSfBdM6uKXZ rTsyLYp7+4Io6MPBzirlx0EYWhQPZMzYPXtflLiGIhI/jmQlOtFT8tVB9MVNtgRDkTpk 0P3g== X-Gm-Message-State: AOJu0Ywqd82XRXsbctOTi0EtAXuqPO/C9DAFzGQOmOnBuvNi1iDF3RYl LMbnGbMKpW5Sk2ILgYe3f21I18OusBJocfialHMXLIcNaxQlO3rj+wYnxP72TRaF8q2Q6aHlN/w = X-Google-Smtp-Source: AGHT+IFYW0tMGYBMYyJElHqFbkyk4fEh65vCuCThTRUgbFYJYXqkQyk2TWEupKviY+WSDhRXscfNqg== X-Received: by 2002:a05:6602:2c8a:b0:807:f0fb:1192 with SMTP id ca18e2360f4ac-834d8406bbamr985278239f.1.1727973539319; Thu, 03 Oct 2024 09:38:59 -0700 (PDT) Received: from localhost.localdomain (97-122-122-36.hlrn.qwest.net. [97.122.122.36]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4db55a64015sm338404173.116.2024.10.03.09.38.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Oct 2024 09:38:58 -0700 (PDT) From: Tom Tromey To: gcc-patches@gcc.gnu.org Cc: Tom Tromey Subject: [PATCH] Further use of mod_scope in modified_type_die Date: Thu, 3 Oct 2024 10:38:52 -0600 Message-ID: <20241003163852.359274-1-tromey@adacore.com> X-Mailer: git-send-email 2.46.2 MIME-Version: 1.0 X-Spam-Status: No, score=-12.4 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 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org I am working on some changes to GNAT to emit hierarchical DWARF -- i.e., where entities will have simple names nested in a DW_TAG_module. While working on this I found a couple of paths in modified_type_die where "mod_scope" should be used, but is not. I suspect these cases are only reachable by Ada code, as in both spots (subrange types and base types), I believe that other languages don't generally have named types in a non-top-level scope, and in these other situations, mod_scope will still be correct. gcc * dwarf2out.cc (modified_type_die): Use mod_scope for ranged types and base types. Issue: eng/toolchain/gcc#241 --- gcc/dwarf2out.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc index 38aedb64470..67d2827c279 100644 --- a/gcc/dwarf2out.cc +++ b/gcc/dwarf2out.cc @@ -13927,7 +13927,7 @@ modified_type_die (tree type, int cv_quals, bool reverse, tree bias = NULL_TREE; if (lang_hooks.types.get_type_bias) bias = lang_hooks.types.get_type_bias (type); - mod_type_die = subrange_type_die (type, low, high, bias, context_die); + mod_type_die = subrange_type_die (type, low, high, bias, mod_scope); item_type = TREE_TYPE (type); } else if (is_base_type (type)) @@ -13964,10 +13964,10 @@ modified_type_die (tree type, int cv_quals, bool reverse, { dw_die_ref after_die = modified_type_die (type, cv_quals, false, context_die); - add_child_die_after (comp_unit_die (), mod_type_die, after_die); + add_child_die_after (mod_scope, mod_type_die, after_die); } else - add_child_die (comp_unit_die (), mod_type_die); + add_child_die (mod_scope, mod_type_die); add_pubtype (type, mod_type_die); }