From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id qDGyJjqvKWoKJgAAWB0awg (envelope-from ) for ; Wed, 10 Jun 2026 14:38:50 -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=glrVmohe; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 6A8EB1E098; Wed, 10 Jun 2026 14:38:50 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.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 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 B71341E070 for ; Wed, 10 Jun 2026 14:38:49 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 48068484B1D1 for ; Wed, 10 Jun 2026 18:38:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 48068484B1D1 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=glrVmohe Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 859F34BA2E05 for ; Wed, 10 Jun 2026 18:38:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 859F34BA2E05 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 859F34BA2E05 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1781116696; cv=none; b=bPTh7qs5oc+E7h4B7lbKj7VF/MNy63PajJnHajuRQvM2LWMYBJFES3S2PFrd8+qbhZpflTfsA5Pcy76617UMeCdFdJpTOmJUR0JAsyIcKzC6K4tLfFVb7YLrKbzEOnlu2TM68VDuIyzRp3pXe1fibDXyxLEAmoWb3ifgmOix1u8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1781116696; c=relaxed/simple; bh=G49FqpL/Aiw650xihPS1NJf4Veqhpyv/OPWn33WlJ4E=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=V6MMxArx1/sANJ6ZLWk3Zn8kBv0DAZhdlxWZ5Mud0dUHMc2+f1u48KjCqDyqM0AlUawPQvVc0Ut6gPXnYlpM2AGuujov6TkhBawlC/JbjeOlNH1//djs2CKsqGpy3Q/+Vc7LT1bLdSqvmnS5kpexBkx/OlbH6Qmub4IGK6H1m5k= 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=glrVmohe DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 859F34BA2E05 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1781116696; 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=IiywEXRbbVUyGrCozKVwkiD8mMcpIQnXxMYaGfiGn8s=; b=glrVmohe9MT2LNRwheODK9Jgiv/3ZMO9sCqUHhrXg9PF8kdbL5k1SZQKGkTdIh4Q6TCqud rHIx1m7F9VzdHmBvhLkZj/YoDWUYbnbtWglLwCkyZEToHJfpG1Qs8fboaLE/DQa9dvmyRN OU9E8tp9YWKsKG80abw+v6In7O91IqM= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-638-OsvPblxbPrKZhvpvXNQ9ig-1; Wed, 10 Jun 2026 14:38:14 -0400 X-MC-Unique: OsvPblxbPrKZhvpvXNQ9ig-1 X-Mimecast-MFC-AGG-ID: OsvPblxbPrKZhvpvXNQ9ig_1781116694 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-45ef93c359fso5870856f8f.0 for ; Wed, 10 Jun 2026 11:38:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781116694; x=1781721494; 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=IiywEXRbbVUyGrCozKVwkiD8mMcpIQnXxMYaGfiGn8s=; b=JJjYZc5MoJagalK3Alc27LnYMZlLCApKxc1tU7oUxc6eWOYWNWoT/x9vbHxA5u5JVE RQRc3Vg9yBo/Yd18codovJRzD7vHSL9qsL5mRT4ULrKbVn51QDTCkB//ocPj5I4z6Z2k xEuDTAEmvQ2n5JQ1U6DFUKfwMQKEcjQFDYUnsbaK4Cg6X+MqueNPhGir9gwKy7u8DCvr KplFwpE2bc6BpxCzh2Fp/MbSL6HvjVIXeO2BrgRcsN6Xj/h5R1v5Vupq085Eq90rz6CS vhrAGnizUQKjZKeE2/rz3qpgJsJqN4ohywkmvM8I9DVK3ObDJJkWM0xZ5uqLT3xipskY h0xg== X-Forwarded-Encrypted: i=1; AFNElJ+KMorUHq5SUbmYK1Sa9FDRgYUepWk0qnXwaJqfWM2ZQgLImb+huv9e5p/sKBpz8CkgeqrJkQ2Al66g1Q==@sourceware.org X-Gm-Message-State: AOJu0YyxVKgOUE1fwT8NA0Xrvw8T3lX+LZ0lbrqSXokHE40flvb26tA5 t2R8q4/1J1ykpluFrbznFEkVmhs9XCqawM9Z/drRgKQoDAPNSBbUCX3weRF67zu3ztNOBeKAz/3 fVN17rpTng00jHWlpUEzG1JvVo+5aF1zoqtvHmNip9Ofyqfpy3C1+OwKtZcHrYZ/DVtHkefU= X-Gm-Gg: Acq92OHv/bvjPlCkp4ZfAa2K9FToJw1YtnIxQ3G7j06oL0GHlkRyceQnDZtNjX0bod8 27ajqDa6eMhQKKOykcb3zErijqsVqUTBIPMwJ6py/t5QaF1Qi4WgZYzachefAfpMUXJICz92bwC mOPiSZ4Au7hjTt52D/Mb74Kmux6oRpr0I/QApx3yPWxQtxf3UmhsyljPFYMjMeMFLRRduP0BtS0 52al0sGnARgrYQMXXh3fxwFul+US9Zb57Zo8sUkObX12gkZPHthlb7OrCb8y7eDfisKjMEn2Gj2 SKLNP2KYZI172AzSOSyUSRf29lFF3Qh8eIMU8g/u7ayLn2Srcosp7raCQp7m7udwEyJIcUzQAjZ sboFdFOImqhuUH2KYplheBaM9kQDJzYaV99MzqRmvqMJtZvrEvKd3gUCl X-Received: by 2002:a05:600c:8216:b0:490:c2a3:23cf with SMTP id 5b1f17b1804b1-490c2a323f0mr393325825e9.34.1781116693589; Wed, 10 Jun 2026 11:38:13 -0700 (PDT) X-Received: by 2002:a05:600c:8216:b0:490:c2a3:23cf with SMTP id 5b1f17b1804b1-490c2a323f0mr393325655e9.34.1781116693214; Wed, 10 Jun 2026 11:38:13 -0700 (PDT) Received: from localhost (92.40.184.118.threembb.co.uk. [92.40.184.118]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4601f35eae5sm74770553f8f.33.2026.06.10.11.38.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jun 2026 11:38:12 -0700 (PDT) From: Andrew Burgess To: Tom Tromey , gdb-patches@sourceware.org Cc: Tom Tromey Subject: Re: [PATCH] Remove ada_value_slice In-Reply-To: <20260605215104.656469-1-tromey@adacore.com> References: <20260605215104.656469-1-tromey@adacore.com> Date: Wed, 10 Jun 2026 19:38:11 +0100 Message-ID: <87qzmep7fw.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: M8KL_-q8nrjcrocUGUUY68ADc4JgUIkLoZK5gDHdvKU_1781116694 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: > ada_value_slice and ada_value_slice_from_ptr are nearly identical. > From what I can tell, the former can be removed without any problem. I tried running the testsuite adding a print out at the call site where ada_value_slice used to be called. I ran gdb.ada/*.exp and gdb.dwarf2/*.exp and didn't see the call site being hit once. Which is not great. I looked at the history of these two functions, and they are both added in commit 0b5d8877912034b2af0c548afbb794e4dcd07fbd, so clearly at one point there was an expectation that these would do different things. If they do the same now, then I wonder if that's intentional, or a mistake because one code path was never used? However, I'm curious about some of the differences between these two functions .... > - > - return value_cast (slice_type, > - value_slice (array, low, *high_pos - *low_pos + 1)); In ada_value_slice_from_ptr the final return is: base = value_as_address (array_ptr) + (*low_pos - *base_low_pos) * stride; return value_at_lazy (slice_type, base); The value_as_address call, for an array, will end up calling coerce_array, which is: struct value * coerce_array (struct value *arg) { struct type *type; arg = coerce_ref (arg); type = check_typedef (arg->type ()); switch (type->code ()) { case TYPE_CODE_ARRAY: if (!type->is_vector () && current_language->c_style_arrays_p ()) arg = value_coerce_array (arg); break; case TYPE_CODE_FUNC: arg = value_coerce_function (arg); break; } return arg; } Notice that for TYPE_CODE_ARRAY we only actually do anything when c_style_arrays_p() is true, which it isn't for Ada. So we're not going to convert the array into a pointer, which means (I think) that the value_at_lazy isn't going to do what you want. I suspect this is why there are two, very similar functions. What are your thoughts? Thanks, Andrew