From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id zAYQBTuDB2qU+T0AWB0awg (envelope-from ) for ; Fri, 15 May 2026 16:34:03 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=SCVyVXcn; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id F1FC41E067; Fri, 15 May 2026 16:34:02 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, 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 8C3F81E067 for ; Fri, 15 May 2026 16:34:01 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C400D5E4CF2C for ; Fri, 15 May 2026 20:34:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C400D5E4CF2C Authentication-Results: sourceware.org; dkim=pass (2048-bit key, secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=SCVyVXcn Received: from mail-ot1-x32f.google.com (mail-ot1-x32f.google.com [IPv6:2607:f8b0:4864:20::32f]) by sourceware.org (Postfix) with ESMTPS id C077A4A9BE52 for ; Fri, 15 May 2026 20:33:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C077A4A9BE52 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 C077A4A9BE52 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::32f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1778877213; cv=none; b=GKB2mdWZzco+LoKwIQ308bgHMak9ix8i2rGEdQ++k8D1NsZ1u/20NPLvXSA2q8ng4/GyxyW4DjLD4DyR6ECEafx2bM0H7p7G5RvsO4/CW3LMl7xEaMO9e9y1huB3LUwOi6TayJqlVhzMKbgv/puO9ymKNIwQk5M6UApXQ9QD87c= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1778877213; c=relaxed/simple; bh=zXMn0kOGvsobvZPzNmziUM3/KYLOCfEmFATvk/jz7KI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=hJjYgaBgVMwyWXYgaejjT7yNtBau21w1IYxZvaSAWzSOAnAgxhBSP/r+gAO7VUZEbOji3oFYnSAPbnuTfsHLqiBKkRSU1SJQIUdoGYIHkVqTStqkMNnhKHsVtj/JwZNY99tia6CTr/fQN9uwriR6+7GkD9KgG8PAptqteiyUwjE= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=SCVyVXcn DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C077A4A9BE52 Received: by mail-ot1-x32f.google.com with SMTP id 46e09a7af769-7de4e6c5a30so392290a34.0 for ; Fri, 15 May 2026 13:33:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1778877213; x=1779482013; darn=sourceware.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=yuyV8MBqlGVwgJ06T0WoqM+tnXRI7OLh3rLu4mEK+DQ=; b=SCVyVXcnWAT8eoxvEm7qA8GHbB3nXTTSo18kVpeUo9vqbcH3bs9Rfs+WnlZQ2SkoWW wv78Hvc2i3yWU4Jcv8G0i9hbS9PXCYZBO7QFlAkV1D8zkKeQzrg2p0l+nbyr0kZ465/G xGOYQcmNZNky2kadNHyoiuRtbPgw+IOn4PFNBo5wI+FPp1ZE5jHl3qlRsEr9YlrXQi6l YeDlQEphvAY1ZBB2bNZIgn7YgBcg+ollGHgmZkL0BpobWJH0IJzXweE3H6Qpozfrfg+V R/WkwoSvANeg/Io8hVHclUTXaRsa8dSnVZDU+TIOTKdogYdJFRxh/uHGQhj6T2iZJnbX wtWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778877213; x=1779482013; h=mime-version:user-agent: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=yuyV8MBqlGVwgJ06T0WoqM+tnXRI7OLh3rLu4mEK+DQ=; b=U+5IZTkjGo1+og24OXAcQKjJ/OtDbcdYUEJVgjb94nrFbIQHC2HeqBcgRbZdDUQv3Z 0JOXQvnWkU5PgS160gLaOoLrszGrcRL1w3q/qh+cvjNejP+9lxbO1p8krUUEaMiByCxK B30E1L5nVr2ZAwRUASvBQrOoRRZMMsuyYu8EDKtIZZCLb0rtI22huBMi7bu2TyJZFmGO 5eW7eEVmwHBf5EfBpaNqwN2Qd0jY5W/qfRL6y81bEhnu7bvI6EZUjBFOXmYr/cBBFYxV 3M+yAACzrNGfdfsEqqaf4hbtFv+hlKJT+nZz7edDD5uwWTuuJoZ1YX4t+A40NcHxlaQN 2cXw== X-Forwarded-Encrypted: i=1; AFNElJ8d2lOIwMACAK5ztdG8TZZ12VtA61N5N2uceSGE27c3bzI1PPxA5jP2yZIiYqwK9cR+YcroZkfkMWAeRQ==@sourceware.org X-Gm-Message-State: AOJu0YyYPCaYvkE5WiawxWhg2Al/JlQ9UIABqCAqp4uKvBmz5EXj7woL 1Z4DJ62zsNCwKY+xyWhDGgHKFIyqnSzcLkwlQG9lHuSGsi0F3hxq+qrodN2jdvU3zQ== X-Gm-Gg: Acq92OFl1IDWyaSTRUyl5SAjN/Fw3K9tANoD/FWVwm3Vdxld47xGrKnMcvPFT7zx+Sy 9Dqpv4vyOZoFp2w9XAABqMuMBWZiGAyQDtp0h2WWngcmTKuFuvW8olOS7aoLIP9OSmrj3pTHkQl KV/DesaHfPqYJTt1p196GdEhXzaFBVT6YKFieAoJt1r/4pQn4dUInWiTCZZjtuiakxLX3ziHCec TLiOKt5PJWVVeBHBaCZBxSo9nEZZO0OZQrKikcjlIA56W0WjeJcWusWtLEJK5ELUi8EkdRu7YoI 67kGV44NJTBqnPnz2pFqu7rn2q8cL8hZEUSswhSYcfC/J75m6PWi8CiOOxlNqQP2EPE3++IzeaB Z7BOVwWHT+opSbVS30hX6L1fYflyw+d8hh6GExpRKX7fj7zch8GDpS3AUuLrpHrj5Ar7aN+8fMh IWvEQbzpwZ7HqtXqj7rqOgZfKB/UmhQMdtM23xcTUVSeuWO3lOylXciw== X-Received: by 2002:a05:6830:3748:b0:7dc:c749:ade3 with SMTP id 46e09a7af769-7e4ea020081mr4014670a34.3.1778877213020; Fri, 15 May 2026 13:33:33 -0700 (PDT) Received: from bapiya (75-166-225-82.hlrn.qwest.net. [75.166.225.82]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7e55b7c68d6sm2051133a34.3.2026.05.15.13.33.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 May 2026 13:33:32 -0700 (PDT) From: Tom Tromey To: Andrew Burgess Cc: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [PATCH] Handle DW_AT_encoding on DW_TAG_enumeration_type In-Reply-To: <87se7scx26.fsf@redhat.com> (Andrew Burgess's message of "Fri, 15 May 2026 20:06:09 +0100") References: <20260513142722.3135998-1-tromey@adacore.com> <87se7scx26.fsf@redhat.com> X-Attribution: Tom Date: Fri, 15 May 2026 14:33:31 -0600 Message-ID: <87v7cofm5g.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 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 >>>>> "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. Tom