From patchwork Mon Mar 11 08:30:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 1910347 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=BriyPKkn; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; 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 [8.43.85.97]) (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 4TtVPW2ywPz1yWm for ; Mon, 11 Mar 2024 19:31:57 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BEF8C385801E for ; Mon, 11 Mar 2024 08:31:55 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by sourceware.org (Postfix) with ESMTPS id 2C6B738582B2 for ; Mon, 11 Mar 2024 08:30:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2C6B738582B2 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 2C6B738582B2 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::42c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710145857; cv=none; b=JL/WTyeB+ULeQKdyHIZIBtiT59xtpCbtPl93K7iEQD7OHBHncq8NczupAzftQ8VXfMv0JL6YhfIPL/oH8H1JMYVnQB8Z1Z9S/j3VNSlRyasCZB/WO8rHtAJ7G91QithaOvc+nvviV4exRf8ikaD6Ixh/7LOcd5EjJHfU9giVYeg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710145857; c=relaxed/simple; bh=EV5DuXSFJ9mtlaFbh759hE3LRbptdtaETLU+qmikfns=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=pX7bLQ9cKeMtS5OJNFKodcxjxCqxxeQmcbe0rar9U1/KPbIXQ0ak43HB0sCZ9lyOgGlV0dESbKVP6+0Ct26LYe9NSktg4CSzwMMCXbfAWcRw8zI414NMsOzJhXTfvJe6fHT4TWBCY8zSV/tHzN/e0dnLb22y3Zww/8ELO3cBspY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-33e9def4a6dso80265f8f.2 for ; Mon, 11 Mar 2024 01:30:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1710145843; x=1710750643; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=SNXQY9szWqoMHMCD5ftgncKgiMjeHtH6xczXPaDZItc=; b=BriyPKknJzqRubzoS6X8iFelfGO1rINWUxNoKZmw9eAUh0JI0urVjbh/+hscBKMx3r KFpkPcdyPvsoEvesWRIMdVBO8M8y/fYxkAM56cMFE70QQ+r8BAQI4JHdft+4tm3l9pAh qbAAJYmLr5wuitRONv6JlCqOacT9dP1fA4MUMNKmanS86kMYRMUqWJT0vcZbYKG2LlGb YS6bbONz9La8gGYuvbVFdd0nmNUwwxgfxaO2I3fkQMynC+d/gFscVZI8DHGck1xgX/qU vHh0y+vUqcaGc7uLoAmwrzlcLmsEqfAhLPyB4kPrs6k9PBssIPX+U4kZfCLWa387IMfO LUVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710145843; x=1710750643; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=SNXQY9szWqoMHMCD5ftgncKgiMjeHtH6xczXPaDZItc=; b=UIPvqPD6gkvsm7VF+6PjePXO1uxvZH6eZ23j7UxFJ7g9YEhaR8uLFtTGL4A1S44LJJ dEUCC6g0cPYFJWhxn0vnrArimftVjJ+lIP9ljWlgd4SFy4nGh+QtT+FONmei2dX88KLi ef5BKuozUfSnj2tvMNYRiegCJ983K8cIE+8ERlITQC54c44zIgCKtZLvFjNQJFsymph2 qalKBwqVxSLtiXXjJjX+K9h6SwiuKDmfROQ2nFdt6t6kpAf954c1DVi60yJNAImZv8eZ bw2Irz3Imo4JG8gVyNAiofDLhqgRm3RkrLYbDxkEUdDWCE9BI0GJioui1543kFpOaBat m26w== X-Gm-Message-State: AOJu0Yy1XZwsE/mBZUAkT5Sja7A0x0sOsIVQeykhkDLMEmg+msNaUX/b t++AXK5aeakoa36rW79aOhuJpiW+1abYnlza95rvzsCnGQ7GWzGpxHDxfHRjAmAooGopSlMbjxQ = X-Google-Smtp-Source: AGHT+IG0RYP9Hmb+WtA3IDR8Yijx9T1M1mZJWQJ7fHpH6zDMDiSP4L/beQF0CGj2BF5RISkslVLJSQ== X-Received: by 2002:a5d:6284:0:b0:33e:4390:c039 with SMTP id k4-20020a5d6284000000b0033e4390c039mr4258160wru.33.1710145842826; Mon, 11 Mar 2024 01:30:42 -0700 (PDT) Received: from localhost.localdomain ([2a01:e0a:8d5:d990:e654:e8ff:fe8f:2ce6]) by smtp.gmail.com with ESMTPSA id co11-20020a0560000a0b00b0033e94233284sm2603628wrb.78.2024.03.11.01.30.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 01:30:42 -0700 (PDT) From: Eric Botcazou X-Google-Original-From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: Fix PR debug/113519 and debug/113777 Date: Mon, 11 Mar 2024 09:30:41 +0100 Message-ID: <2318264.ElGaqSPkdT@localhost.localdomain> MIME-Version: 1.0 X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, 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.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 They both come from an oversight of mine in the placement of the DIE created for an enumeration type with reverse scalar storage order. Tested on x86-64/Linux, both GCC and GDB, applied on mainline as obvious. 2024-03-11 Eric Botcazou PR debug/113519 PR debug/113777 * dwarf2out.cc (gen_enumeration_type_die): In the reverse case, generate the DIE with the same parent as in the regular case. 2024-03-11 Eric Botcazou * gcc.dg/sso-20.c: New test. * gcc.dg/sso-21.c: Likewise. diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc index 03d73f9eecd..9b1548e4ae3 100644 --- a/gcc/dwarf2out.cc +++ b/gcc/dwarf2out.cc @@ -22868,18 +22868,19 @@ gen_enumeration_type_die (tree type, dw_die_ref context_die, bool reverse) if (type_die == NULL || reverse) { + dw_die_ref scope_die = scope_die_for (type, context_die); + /* The DIE with DW_AT_endianity is placed right after the naked DIE. */ if (reverse) { gcc_assert (type_die); dw_die_ref after_die = type_die; type_die = new_die_raw (DW_TAG_enumeration_type); - add_child_die_after (context_die, type_die, after_die); + add_child_die_after (scope_die, type_die, after_die); } else { - type_die = new_die (DW_TAG_enumeration_type, - scope_die_for (type, context_die), type); + type_die = new_die (DW_TAG_enumeration_type, scope_die, type); equate_type_number_to_die (type, type_die); } add_name_attribute (type_die, type_tag (type));