From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id dcnrOmpRCGphpz8AWB0awg (envelope-from ) for ; Sat, 16 May 2026 07:13:46 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=O8w4ThDD; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id DCD761E0B1; Sat, 16 May 2026 07:13:46 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 3E3E11E093 for ; Sat, 16 May 2026 07:13:46 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A013D4BAD17A for ; Sat, 16 May 2026 11:13:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A013D4BAD17A Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=O8w4ThDD Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id 389984BAD14F for ; Sat, 16 May 2026 11:13:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 389984BAD14F Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 389984BAD14F Authentication-Results: sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1778929999; cv=none; b=E3qLgLzMCyAbBJc5LXe2q0WOGMt11n6+DdijWa9iGwIJdSbdKYYLF9q2/46CAkwyTtxUpAO0iho2IPGDsXCX99pDiLf9g8Zxc2Zmm6Vpsb+b/FlYN53FPuE1h6g+tTSfplWZV+twuNdCmsVm7TJaxj8FgH4+//plN9tjyuhpxes= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1778929999; c=relaxed/simple; bh=cLIBKNbEbPh4ST+IprkdQHrfQcYEUoPU8aBH5pj6l8E=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=qFzuEZH2LGWSMrB8Hg99HPxd7i2IGsoXLXcLn/8wDYQQnQJfwdOkiTXaxZkkIdCXzKLV7qbkK3SdP8rA3x6wqoXqKjFVleDlQmCHZVq3XLMKzfBouThXHdgvnnnlWXjsE+Z4MzMCGodXQ7mWkyl2fBDPORoW4W7CPnHZtEVc154= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=O8w4ThDD DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 389984BAD14F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1778929998; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=wfkKaeLTq1q/0amJ7tzMSX3FXNSCXa3ALZvHI6XiHng=; b=O8w4ThDDI2SskczfXYZnYov8LHxCxqAKg4pkFIE3f26xUvXI/RPv6HPwVoC5E3vZKWp5mt K1Uq65idNX5j4xB4sipFkwaTtBAGr1O/7LQ2thJyxrusios+YPYAnClx3vIrDcHkg0EGyv petNidfHgbb1LsJXMjjjz/ZFTF7/fmY= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-647-sdHsaZ-vOseUzN2jsAtoeQ-1; Sat, 16 May 2026 07:13:17 -0400 X-MC-Unique: sdHsaZ-vOseUzN2jsAtoeQ-1 X-Mimecast-MFC-AGG-ID: sdHsaZ-vOseUzN2jsAtoeQ_1778929996 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-48fe3e73da6so2815755e9.2 for ; Sat, 16 May 2026 04:13:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778929996; x=1779534796; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=wfkKaeLTq1q/0amJ7tzMSX3FXNSCXa3ALZvHI6XiHng=; b=r5MGfJ61A0BI7Lm14aBUhj2xsdXxbH8MoU0lbsUv3lDlwjUi6SgpWPSaOEeiJZc7sY cvPhZp3bdXdOSMrg/eB33lgTBDXtv/LCZ/uZRlWti0def5jCEXC/8fez9fkrXWque+bi P2ZVhjLemLlvjWHES57t5kFObrQA5we+p6C058Mt7DJ+RSdNMRFfdtvz8lHuXbClDEle xlqVK1+o0s7zYgp0bUbCN3FTTLm5PEH3dDUwkeGrsSswzsp6quvhZb0QlleJ2kigw/cr QkBtuIR8evbjXKaIiZZX8ic5pDKrxG5TBHAcqc4F6ukJnGufyU4N631q4VPiYjCfGTLR Jl3Q== X-Forwarded-Encrypted: i=1; AFNElJ9QZF0kqJ3/35AlI/lZ+3UXgFth1D3agSAEvNzKzu2UYD7Lkce219t7oRvShXDV8FEhhHijRK6yryZUsQ==@sourceware.org X-Gm-Message-State: AOJu0Yw6xaw9ojaVINBa8VOZo+XpaCKErbpO80lzFvcMNFcQyhiuUf8X TiSFUq4FXNpa9yMk5HlzHswUU/u43JXD9dF+fGArLKPbve8lbmCSir9ujPPuWbk2Mp/zK0NlAy0 bw4sD3dnzVgRNCPHnU8d9Mvrvc1o3Bui5e9prkI7CO206HDv3J2ZUi1+/Sb/qe5zN72X0/v4= X-Gm-Gg: Acq92OE7D1hVqL2mqAzeG3KcUwVWjvxQgTpNt+iOI5Xi03ACBie7rwCmk6KPlvLe2n3 qIJXlP5PKEca5gQHrVev+wfLfD5P3CKYQY1OqWkhhc/PqKpLS6FqzQ3Rmqo1bZRlxzVRUGFhT9P TUvyq8pbcLcwORbuaHhRB0bH5adl7blIKOKZ2gGJ+wXfqGvOEk+/1cIpgzAt7JpvaPIih6dg+qo QPXKtmBWGWr7fVdl8+d4yBDREOqikjN7pxndYzO8WfohngYTvfSQKVFf+miF19GytOk+9sJwWUy egBau0ItjclCt7CDZ7m5QvqjiQSgxiJlmesrGHWe20DjNlVpCd5piG5BNcj6AN3VR0mibPfKxrS ZDB/7SnWxl1crFSzQv46hrdDEdgwr X-Received: by 2002:a05:600c:a102:b0:489:a4:e578 with SMTP id 5b1f17b1804b1-48fe60da919mr79801205e9.14.1778929996043; Sat, 16 May 2026 04:13:16 -0700 (PDT) X-Received: by 2002:a05:600c:a102:b0:489:a4:e578 with SMTP id 5b1f17b1804b1-48fe60da919mr79800985e9.14.1778929995556; Sat, 16 May 2026 04:13:15 -0700 (PDT) Received: from localhost ([109.144.20.165]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-45da0a19c2dsm21923955f8f.21.2026.05.16.04.13.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 May 2026 04:13:15 -0700 (PDT) From: Andrew Burgess To: Tom Tromey Cc: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [PATCH] Handle DW_AT_encoding on DW_TAG_enumeration_type In-Reply-To: <87v7cofm5g.fsf@tromey.com> References: <20260513142722.3135998-1-tromey@adacore.com> <87se7scx26.fsf@redhat.com> <87v7cofm5g.fsf@tromey.com> Date: Sat, 16 May 2026 12:13:13 +0100 Message-ID: <87pl2vd2uu.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 1Edu41mPXx7DPvYmndDyDqslt-r2NHG-pMlO-tPf4og_1778929996 X-Mimecast-Originator: redhat.com Content-Type: text/plain 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~public-inbox=simark.ca@sourceware.org Tom Tromey writes: >>>>>> "Andrew" == Andrew Burgess writes: > >>> First, this is yet another instance of a general problem with DWARF. >>> See https://sourceware.org/bugzilla/show_bug.cgi?id=32680 for the >>> analysis. > > Andrew> Should there be a Bug: .... tag for this bug? > > Yeah. At first I wasn't sure but see below. > > Andrew> I tried running your new test against GDB 17 and can confirm that it > Andrew> fails. But I also tried against GDB 16, and the test passes, and the > Andrew> output looks fine. > > Andrew> You commit message seemed (to me) to indicate that you didn't think this > Andrew> should have ever worked, but it looks like something changed 16 to 17 > Andrew> that broke this. It would be nice (maybe?) to understand what changed. > > I looked into this and I introduced this difference in > > commit 5363deffcfb1c1825db3a8446d377a0ad56eff70 > Author: Tom Tromey > Date: Thu Mar 20 09:52:08 2025 -0600 > > Use correct sign extension for enumeration types > > ... without a test, which is disappointing. > > Anyway, though, I still think that patch is probably correct, at least > as far as *this* test case is concerned. Consider one of the > enumeration literals, dumped by eu-readelf to show the form: > > [ 13b6] enumerator abbrev: 1 > name (strp) "value_129" > const_value (data1) 129 > > "data1" is inherently ambiguous, from DWARF: > > The data in DW_FORM_data1, DW_FORM_data2, DW_FORM_data4, > DW_FORM_data8 and DW_FORM_data16 can be anything. Depending on > context, it may be a signed integer, an unsigned integer, a > floating-point constant, or anything else. A consumer must use > context to know how to interpret the bits, which if they are target > machine data (such as an integer or floating-point constant) will be > in target machine byte order. > > ... which is the aforementioned bug. > > Now, we could change update_enumeration_type_from_children to also > examine the attribute forms, with the idea that if we see DW_FORM_sdata > then it is definitely signed. While that wouldn't help this particular > test, it's possible to construct one where it does. In fact I happened > recently to be investigating this for gnat-llvm, where there's a type: > > [ 10cf] enumeration_type abbrev: 21 > name (strp) "tag_t" > byte_size (data1) 1 > decl_file (data1) p.adb (1) > decl_line (data1) 20 > alignment (udata) 1 > ... > [ 10de] enumerator abbrev: 22 > name (strp) "object" > const_value (sdata) 18446744073709551615 (-1) > > Here the enumeration type doesn't specify a sign, but there's a constant > that is clearly signed. FWIW this occurs in array_of_variant.exp. > > I'll address this in a separate patch. Thanks for digging into this. I figured it was probably going to be something like this, but it's nice to know (at least for me). I agree that this patch looks good to go in. Thanks, Andrew