From patchwork Wed Jun 12 02:07:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 1946605 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=ebquA9C+; 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 4VzTTs1VKtz1ydW for ; Wed, 12 Jun 2024 12:08:17 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C51F3385B529 for ; Wed, 12 Jun 2024 02:08:11 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by sourceware.org (Postfix) with ESMTPS id 3102E3858410 for ; Wed, 12 Jun 2024 02:07:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3102E3858410 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 3102E3858410 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::52f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718158052; cv=none; b=quWyvtGd8Pym04pH0f0sg59lNyr8DQq4ZCd5Eu64fKAqjC9GRPWiNOMcxoRz4LFfMeleavodzea2EkGKerm82QY9HzE3PplvRJlkfSwJB9SIyTY8X2xhRHhe2TwyWU/UvZA0bpQeCFSQqg2IZaojAwTUQmIKdWWE/6zE48MjSf8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718158052; c=relaxed/simple; bh=YeKM19V7yIM2ZNyc4ZPnPDaH9/Ys/nBtTxy/7qutmhs=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=BiXQHdQ1lkZVLpCmA4/CH52VKcaxbOlP/bh7pnXoLwrHSA/59kP5Itep+3x+++blWo2E/4sqh7z9vDVDtXEL8AN3xgWQdDr+ZHkk8lzqYwvYg0r047BHEBWIe4JXWdRM30UIke9dfZbAbyoSowFpr2lm62fh/wnPHfqFO3VXw0E= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pg1-x52f.google.com with SMTP id 41be03b00d2f7-6c702226b0aso316784a12.1 for ; Tue, 11 Jun 2024 19:07:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1718158049; x=1718762849; darn=gcc.gnu.org; h=mime-version:user-agent:message-id:date:organization:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=jOMUn0kFD07z+RoTYJpn2jHQAqWW8uytXwfn/1pRK+c=; b=ebquA9C+xiEnPvemDxpXZWOnRpwE/2lbL3/JTt7uJeiOD8zAOcZ5xnFGDCV1Gny5SV PIIWVs4LwONZUHPAw/gnYQrsk5uDBr3R/4TvwJd1dzgKoP/fmRweCf/RQDWCgAbvWshR /2O4nGfhi2rgl1soq4vgae6UuIBVH1EYwqR/sz/B2wk1gxPZEagbfDekulDREcfH42T4 T2Isi9rlVwM9gpUSUpJMSGQ3HniT/hkifbCObopP59hWYpzZAPdhkOO67jhK62xvtItE 39wr4x2KmDCEm8M6CHBI4y4IbbYd9tnuLud4WwouV4EyLa5y5stKsGVgf7Y3ZYArbTir myvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718158049; x=1718762849; h=mime-version:user-agent:message-id:date:organization:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=jOMUn0kFD07z+RoTYJpn2jHQAqWW8uytXwfn/1pRK+c=; b=rUpKAHTldxJlG37BZe/4/dMkHj+yTZn0+V0MLw1LdHwAAoWQz1PPDryV9j7kdgVhry CK+OvfVUrNOuf/xDIM09GrAw/7z1v6G0WLOwI51AbhLwibZMcTp9kkBN3Ra1DhgmPGYj M/AEL0QoNPeXmYoiXfzbVjxbBLqab9N1aIzI7ytw6kE/sQW+3oQ+3+esKtBMZ+8ruiRz It0Da91Jlf0Htpq/+4ZtUFo2ssO8x2IL72xdLnKrs7rU9px7g5/tCPIWWclhzYQz0wDJ 9+WAMOnlIK8H4JX+wB1p07FViwa6/biZ0ZBAGQfc9k7ljmQOqSgX27aZDIG6qdHo/Jyg l7Jw== X-Gm-Message-State: AOJu0Yw/9snjbQ+nzW4+tir2jxEsd2cAuC5E+3b07uM6OILZn8WB2j60 ofhpqDAW1Fm0+EERsPP6Cpc/wN3BYz1WgZxnj2EItyPuHUJPEzJ3Ioev9ye5z9AjA8aqLKYYnI2 oeg== X-Google-Smtp-Source: AGHT+IHWFCNhBYDdcvjZce87fScppZbQ/NE6ou6qk1qaARb/e1ph0RIVeU6zI2s0eF0QE89n3ugftQ== X-Received: by 2002:a17:902:c144:b0:1f6:fbcd:d9bf with SMTP id d9443c01a7336-1f7287a76b5mr50396435ad.8.1718158048770; Tue, 11 Jun 2024 19:07:28 -0700 (PDT) Received: from free.home ([2804:7f1:218b:1961:ef8:d680:5399:8b1a]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f71a902a5csm40695315ad.37.2024.06.11.19.07.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 19:07:28 -0700 (PDT) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 45C27IS51125648 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 11 Jun 2024 23:07:18 -0300 From: Alexandre Oliva To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [FYI] map packed field type to unpacked for debug info Organization: Free thinker, does not speak for AdaCore Date: Tue, 11 Jun 2024 23:07:18 -0300 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 X-Spam-Status: No, score=-11.9 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, WEIRD_QUOTING 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 We create a distinct type for each field in a packed record with a gnu_size, but there is no distinct debug information for them. Use the same unpacked type for debug information. Regstrapped on x86_64-linux-gnu. Pre-approved by Eric. I'm checking it in. for gcc/ada/ChangeLog * gcc-interface/decl.cc (gnat_to_gnu_field): Use unpacked type as the debug type for packed fields. for gcc/testsuite/ChangeLog * gnat.dg/bias1.adb: Count occurrences of -7.*DW_AT_GNU_bias. --- gcc/ada/gcc-interface/decl.cc | 4 ++++ gcc/testsuite/gnat.dg/bias1.adb | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc index 8b72c96c4396a..e97ff64a4805c 100644 --- a/gcc/ada/gcc-interface/decl.cc +++ b/gcc/ada/gcc-interface/decl.cc @@ -7786,6 +7786,7 @@ gnat_to_gnu_field (Entity_Id gnat_field, tree gnu_record_type, int packed, /* If a size is specified, adjust the field's type to it. */ if (gnu_size) { + tree debug_field_type = gnu_field_type; tree orig_field_type; /* If the field's type is justified modular, we would need to remove @@ -7844,6 +7845,9 @@ gnat_to_gnu_field (Entity_Id gnat_field, tree gnu_record_type, int packed, && !DECL_P (TYPE_NAME (gnu_field_type))) create_type_decl (TYPE_NAME (gnu_field_type), gnu_field_type, true, debug_info_p, gnat_field); + + if (debug_info_p && gnu_field_type != debug_field_type) + SET_TYPE_DEBUG_TYPE (gnu_field_type, debug_field_type); } /* Otherwise (or if there was an error), don't specify a position. */ diff --git a/gcc/testsuite/gnat.dg/bias1.adb b/gcc/testsuite/gnat.dg/bias1.adb index 016a159b692da..d9a00a1aa4588 100644 --- a/gcc/testsuite/gnat.dg/bias1.adb +++ b/gcc/testsuite/gnat.dg/bias1.adb @@ -1,6 +1,7 @@ -- { dg-do compile } -- { dg-options "-cargs -g -dA -gnatws -fgnat-encodings=gdb -margs" } -- { dg-final { scan-assembler "DW_AT_GNU_bias" } } +-- { dg-final { scan-assembler-times "-7.*DW_AT_GNU_bias" 1 } } procedure Bias1 is type Small is range -7 .. -4; @@ -31,4 +32,4 @@ procedure Bias1 is begin null; -end Bias1; \ No newline at end of file +end Bias1;