From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id fMmNHJ1kkGph9wYAWB0awg (envelope-from ) for ; Thu, 27 Aug 2026 12:23:57 -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=iyQGYacI; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 52F5A1E166; Thu, 27 Aug 2026 12:23:57 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.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 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 1D6D71E033 for ; Thu, 27 Aug 2026 12:23:56 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8BB024BA9012 for ; Thu, 27 Aug 2026 16:23:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8BB024BA9012 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=iyQGYacI Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by sourceware.org (Postfix) with ESMTPS id 55D014BA2E23 for ; Thu, 27 Aug 2026 16:23:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 55D014BA2E23 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 55D014BA2E23 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::62d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1787847810; cv=none; b=goacBAq6v3aaNLj73tWVZFQJoxI2efGqRm4XrXo07+rT8dQ5yv0hnUpVfBgldfgFqRgB3CQFTThSrgsvi5rKFtce8RYSbZyw7wi11FgonomqWfo27VtwEnZsr1W9SomijfqbLeq0m4XfJKR1x31XbToUVZzRZu/iB4FrHC4Tv6c= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1787847810; c=relaxed/simple; bh=xHPYk5A+Q6+cAYEQoDcTeCXJwuEjsXm9nnia+4EHJqI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=jm3uSMW6VhBo9d9KZJnHFCuXq2StQyAiM7e9MdEQ2MLt3Hg3p1sBMiufKn30g+mC7+8L9F1ONBwbIapJnEbgoxEhsaZ4qu5lcWPPnYN7eTtugnx1wCHby2pUj01+qcMIG3SgnBVAv3RllrzoYYOht+5IqZ1+WXOUm05ujI6oL70= 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=iyQGYacI DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 55D014BA2E23 Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-c2531f453eeso4308766b.3 for ; Thu, 27 Aug 2026 09:23:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1787847807; x=1788452607; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=BJOU3jspeqeCsOgditf9//xwitW5D6Xlzpkd2djbaFE=; b=iyQGYacI0kGax2c/yYbWOgKFRLG2zXHuWDiUfxZ49GEk8M9qkh2oMWHqp2YHCst1PS WeU53FO4qL8D2TEtT+GrgTmpINfBkti5dC8wrIzf50meIoa0Hn3qGpbD7xMP6e9i8S+I HxewWYimhuL4B+xCJuSQ+6fQNjJfMEXjUh1IvPge/0ZMjb/1vFVF7vYD49ZCxi6Hv4KX X2tBEKO5XytD+qNwqr76tM7vi3Fd885yVongljfRoIgwdyMYhSNu0xbi9kZbOh3F3G2x bgx9shOrLo1W+EYN1dTzXbYubRW3NISs67t02RlTh1f1sAr1cIiHuwBRoIaMp/ez3Com Cwag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787847807; x=1788452607; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=BJOU3jspeqeCsOgditf9//xwitW5D6Xlzpkd2djbaFE=; b=lfyO8He+ehSVnljmfdkxmwp08+hdc1vSejUfKc+YYW5+FzlEQI8sDRNOsIt6h++j4b +5Fg4CeUvX3jg088qoFVeFBbK44eNLj5xi5XUOqKD/xxh9y0E09a36jLcdq84ZDeFIkP hd44TxrcIShoE5RbCHCmfu8IfeK2dy4pnFD9HxQh29Yr6EKXeFJ50ZXwH5PNvO+X86W+ Ip77ILoC8fSQkXH3BH9Gb5BTNz261duAuD7ku5Pl/8+cAeJhrv+32+YaywfhEmM5vPLF oXb0qYG61DmCzyvn1oG03zvcM+iuIuwHnaj48KU6ctkEnYz47rzeD4zwWRoxgh2fvjEk JO1A== X-Gm-Message-State: AFuF++k0PwX4ImphktSs0yccYyEr9ka1Y0c8bud6I6gBRkR1FfThKtrd +GjzwGT/BlKUsPIKVPEU28HTGVB7OrbUUwwwq73/XGVp9x96DbQrlg/I1Kx38BJF5qpDXDfWWQT qUd2/ag== X-Gm-Gg: AR+sD10L0+OlTT4GTRI6v0+rSplz7HIszUA3Cp8LmA3z4Rpu08UAWcSM5RExTv/tZWY Mt2MJ/6TYMV+niPvXw/HBxmkINTx4WMh4hU9jECFvDf4BPehq4FyZIL9q6YLvES8665LU179Xsh vK+FSnOQLgCe7FL4Nq3q+LxOqm7PyfuJaNePZKF4wJ4pWbDR0zOs+gpxUdbzTvGKG/GQZQvwEWj 6stVjnTyUQZ+RUl2VPGGl2D4SLb6i0z/sh30ZJuSBLagqYptz/8iP/cNyP0SFhj1ux/jLLRzpFp yDik/We7CGlJLO9h88vBTgx8yseccs9mr0hhnpyLwd35aUkibf4CB1fjxqcD8qsk/P3JRz7qirx tnwUFKnabXBVOWvnxU+mit/CjBnrCpH2oyHZmLuiYzLcjnNuCI4pK6Stn9vkEz2dpARqa+DkJD0 wLQREccULVij4ke4+HggwxjQdulDENZVid+dAKKOAuk0Or4LiGQn7ReYtna81krMjMKItSsXcdL 951 X-Received: by 2002:a17:907:d07:b0:c19:5572:d234 with SMTP id a640c23a62f3a-c250bb3791amr1693976366b.1.1787847806695; Thu, 27 Aug 2026 09:23:26 -0700 (PDT) Received: from bapiya (97-122-117-2.hlrn.qwest.net. [97.122.117.2]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c250a9b3cf9sm612270266b.50.2026.08.27.09.23.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Aug 2026 09:23:26 -0700 (PDT) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Test more branches in ada_convert_actual Date: Thu, 27 Aug 2026 10:23:22 -0600 Message-ID: <20260827162322.1256735-1-tromey@adacore.com> X-Mailer: git-send-email 2.55.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Coverage testing showed that some parts of ada_convert_actual are never tested. This patch adds a test for one of these, namely the handling of a formal parameter whose type is an "aligner" type. This test is written largely in C, because actually getting the compiler to emit this seems tricky. Eric pointed out some code in GNAT explaining why: /* Either for foreign conventions, or if the underlying type is not passed by reference and is as large and aligned as the original type, strip off a possible padding type. */ if (TYPE_IS_PADDING_P (gnu_param_type)) ... --- gdb/testsuite/gdb.ada/padded-formal.c | 38 ++++++++++++++++++++++ gdb/testsuite/gdb.ada/padded-formal.exp | 42 +++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 gdb/testsuite/gdb.ada/padded-formal.c create mode 100644 gdb/testsuite/gdb.ada/padded-formal.exp diff --git a/gdb/testsuite/gdb.ada/padded-formal.c b/gdb/testsuite/gdb.ada/padded-formal.c new file mode 100644 index 00000000000..7f882483c4c --- /dev/null +++ b/gdb/testsuite/gdb.ada/padded-formal.c @@ -0,0 +1,38 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2026 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + + +typedef unsigned short pkg__myint; + +typedef struct { + pkg__myint F; +} __attribute__ ((aligned (8))) pkg__myint___PAD; + +pkg__myint +call (pkg__myint___PAD padded) +{ + return padded.F + 7; +} + +pkg__myint value = 16; +pkg__myint___PAD pdv = { 16 }; + +int +main() +{ + return 0; +} diff --git a/gdb/testsuite/gdb.ada/padded-formal.exp b/gdb/testsuite/gdb.ada/padded-formal.exp new file mode 100644 index 00000000000..c51a56d29b5 --- /dev/null +++ b/gdb/testsuite/gdb.ada/padded-formal.exp @@ -0,0 +1,42 @@ +# Copyright 2026 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Test that a value can be passed to a function expecting a padded +# type. + +load_lib "ada.exp" + +require allow_ada_tests + +# This is written in C because actually constructing such a test case +# is difficult or maybe even impossible with recent versions of GNAT. +# Originally padding was used when passing Long_Long_Float types; see +# commit 8344af1e ("[Ada] error trying to call function when parameter +# is aligner type."), but this no longer happens. +standard_testfile + +if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { + return +} + +if {![runto_main]} { + return +} + +gdb_test "set language ada" \ + [quotemeta {Warning: the current language does not match this frame.}] + +gdb_test "print call(value)" [quotemeta {@DECIMAL = 23}] +gdb_test "print call(pdv)" [quotemeta {@DECIMAL = 23}] base-commit: 1ad761d978807cdd3a9972e32db6e3899de2115d -- 2.55.0