From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id NohpNRFPWWrITg0AWB0awg (envelope-from ) for ; Thu, 16 Jul 2026 17:37:21 -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=ACGa7dKt; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id C93411E033; Thu, 16 Jul 2026 17:37:21 -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 [IPv6:2620:52:6:3111::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 299C81E033 for ; Thu, 16 Jul 2026 17:37:21 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9AAD14BA23C6 for ; Thu, 16 Jul 2026 21:37:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9AAD14BA23C6 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=ACGa7dKt 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 45DD64BA543C for ; Thu, 16 Jul 2026 21:36:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 45DD64BA543C 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 45DD64BA543C 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=1784237814; cv=none; b=qCeKKSr5ddn77oKJNEmSDMtj91oLk523nvyXabKhA6cUJjhrURUb36k4ceb04oQKh86I5w3i90rfpY7Nlnh8Z4qrorwFXOm71Z2hUDn1rtzPS9vtSd3GNOUo8aimroi7iT4Q2B3ff4kDADuUhj4yF1VTTi5HUTBRHI4fLz/N9KI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1784237814; c=relaxed/simple; bh=aumpQg+P3mQInRb3kzhzUJpY9+8ZezP8FbqtWioGgFE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Kfh9kHZnSRLq3tfAorWwqnKsDDDak0LGgvoIwI0dKgziAKWqSaVcMU6cN1XCcHCCYaFusZZsNrMCOojVqeu0/X0ExWfm/PgHeNzj75vyuv+AixgA7uMHR3WS15DZnjdeOWPVaXUJm5TA+X73EW0rqOnoNoDzw/vSSAXWt6GuQH8= 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=ACGa7dKt DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 45DD64BA543C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1784237814; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=dS6tZG+JcWciNERhayvI+of/kbKOGnOSG4YCxKykWqk=; b=ACGa7dKtdAG8+3M3PTwJilLzMRApHhLCDIJcBnkw053wI7RhqxoPBBRU+rBSlD5vazf1QL wMMTv1et7TG41rThEiCQTcgxAx8vLi0OW+Ddy44eSu9+Uez+ZBT9kZpFBQorwrDECHWWom Fw1RkFhjhIeD7saSMbnc6mg+xp5YVDE= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-280-TUk7tQDPPue1pFu5uniu-Q-1; Thu, 16 Jul 2026 17:36:52 -0400 X-MC-Unique: TUk7tQDPPue1pFu5uniu-Q-1 X-Mimecast-MFC-AGG-ID: TUk7tQDPPue1pFu5uniu-Q_1784237811 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-47f3e6cc5c4so2215577f8f.3 for ; Thu, 16 Jul 2026 14:36:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784237811; x=1784842611; h=content-type:mime-version:message-id:date:references:in-reply-to :subject:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=dS6tZG+JcWciNERhayvI+of/kbKOGnOSG4YCxKykWqk=; b=hQVBUi3Nub10GdlNhQMopipNHEHRf4c6K7Mx+YQHlqQzV5xaBDUTB2aNfTwgkGM1wj ThFLk0i0fncYWefK2WkkseLxJvjQkvkXBSNMxWFv2CNWATVzo66sTlxfyfhLZKNHujBt jrIG6jA3EP0S/1Wf1nSdZmbtkXjrwL7ecWkW0WAiezQNy539tB3M3eoe9+SEAZ4qtui1 zokBmsN43rMHF2k5qNGj9wJ4iPzcGUfGZRd/NjF2IFJuAwfvn6AtDooNArtLUC64TdH9 j7EbmxxjuoY+/hf1IrwvDSFzB9xgf/2ZjbM9lIg+4Cf/B2+sHghavEldyHChSwCgnNnI y1xg== X-Forwarded-Encrypted: i=1; AHgh+RqEodo5jK/kFWv8iHndVCGU+6k51UznxxlleHlBCJzseTUuxy6Iu4z+VYxP6dPwlIYopFRdcJuUpG9kIA==@sourceware.org X-Gm-Message-State: AOJu0YxWdj7Oe5Z2Yq2EYmmK+dR1tcqi4oKFBg5HdqDFWkCiUaPFs7Ua US1S1Y2l2tjgI+rX3VMnmVtSY9LnEvPLED30dL6j3MXsK1XbaI3xJF/SEUoezq0Sk74AeaJ1VbP 65j4ojnIQmFOaoltDYJ0riEegIfmc0lcF+YDj+BZ+z+npL70sua8f6NSAAHDK/0PHpI/kfec= X-Gm-Gg: AfdE7cm6csJP3E46jgKXcQbYierg+ED7DjKbnAMexm6bjBhh1N0QEtL+FopoddkC0ke Z27ZzfUPSljvZpoDv3GwD7sfZ4z//mRDj0JJhKkZ3zoIP6kpFkfjEQrYhg5olP4taqKJmigKK7o PUBcrMLF2kr3r2Vobv3LebkjB1P3ecsl5J5bzAaniXJIknHENC8gKxIAPJmDT1OTVQaBG038c/K jmEYOJ9IFqbP+IytPM16zvfOJuvS9ykYi3LUhIukP+BBnjDWh34Jgcgf2eBhKZ2yQuvosf/pwbj lhH4GAnKQbpNWdalVucS5PdzbYQ9YWfMP14IJKEfG9HP7BlOJiWGgwdXYf+n04tXkGP3PX6y X-Received: by 2002:a05:6000:1789:b0:47f:285c:9769 with SMTP id ffacd0b85a97d-47f6078d2fbmr1008666f8f.10.1784237811209; Thu, 16 Jul 2026 14:36:51 -0700 (PDT) X-Received: by 2002:a05:6000:1789:b0:47f:285c:9769 with SMTP id ffacd0b85a97d-47f6078d2fbmr1008640f8f.10.1784237810773; Thu, 16 Jul 2026 14:36:50 -0700 (PDT) Received: from localhost ([31.111.209.233]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47f4635ac2esm26904326f8f.13.2026.07.16.14.36.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jul 2026 14:36:50 -0700 (PDT) From: Andrew Burgess To: Pedro Alves , gdb-patches@sourceware.org Subject: Re: [PATCH 4/4] gdb.base/callfuncs.exp: Exercise "long double" In-Reply-To: <20260714220631.1499846-5-pedro@palves.net> References: <20260714220631.1499846-1-pedro@palves.net> <20260714220631.1499846-5-pedro@palves.net> Date: Thu, 16 Jul 2026 22:36:49 +0100 Message-ID: <87qzl2d3bi.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 7v4Hd_2LgmCAKOfhBnozmumBQwOvLoQDyoQo4g3cS0I_1784237811 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 Pedro Alves writes: > gdb.base/callfuncs.exp tests calling functions that take and return > floating point arguments, but only for float and double. Add long > double too, so that GDB's handling of the type in inferior function > calls is exercised. > > On x86_64-pc-windows-msvc, without the fix that teaches GDB about the > correct size of "long double", we get: > > $ grep FAIL gdb.sum > FAIL: gdb.base/callfuncs.exp: noproto: p ((int (*) ()) t_long_double_values)(45.654L,-67.66L) > FAIL: gdb.base/callfuncs.exp: p ((int (*) (long double, long double)) t_long_double_values)(45.654,-67.66) > > These two tests go through GDB's expression parser for the long double > type. Without the long double fix, GDB is passing 128-bit (amd64 > default) but on the MSVC ABI, it should be passing 64-bit. > > The other tests pass even without the fix, as those are direct calls > that get the parameter type from DWARF, which has the correct long > double size. LGTM. Approved-By: Andrew Burgess Thanks, Andrew > > Change-Id: Ibcc3590753d08ece4fbf03c5d890872197047fff > --- > gdb/testsuite/gdb.base/callfuncs.c | 58 ++++++++++++++++++++-------- > gdb/testsuite/gdb.base/callfuncs.exp | 26 +++++++++++++ > 2 files changed, 67 insertions(+), 17 deletions(-) > > diff --git a/gdb/testsuite/gdb.base/callfuncs.c b/gdb/testsuite/gdb.base/callfuncs.c > index 0e6d9dcdd71..918e8d6f97d 100644 > --- a/gdb/testsuite/gdb.base/callfuncs.c > +++ b/gdb/testsuite/gdb.base/callfuncs.c > @@ -72,6 +72,24 @@ double double_val13 = 10.25; > double double_val14 = 11.25; > double double_val15 = 12.25; > > +/* "long double" cannot be pasted into a "long_double_val1" > + identifier, so the long double globals use an "ldouble" prefix. */ > +long double ldouble_val1 = 45.654; > +long double ldouble_val2 = -67.66; > +long double ldouble_val3 = 0.25; > +long double ldouble_val4 = 1.25; > +long double ldouble_val5 = 2.25; > +long double ldouble_val6 = 3.25; > +long double ldouble_val7 = 4.25; > +long double ldouble_val8 = 5.25; > +long double ldouble_val9 = 6.25; > +long double ldouble_val10 = 7.25; > +long double ldouble_val11 = 8.25; > +long double ldouble_val12 = 9.25; > +long double ldouble_val13 = 10.25; > +long double ldouble_val14 = 11.25; > +long double ldouble_val15 = 12.25; > + > #ifdef TEST_COMPLEX > extern float crealf (float _Complex); > extern float cimagf (float _Complex); > @@ -359,20 +377,23 @@ float float_arg1, float_arg2; > #endif > > /* Define a function NAME comparing its two TYPE arguments against the > - TYPE_val1 and TYPE_val2 globals. */ > + TYPE_val1 and TYPE_val2 globals. PREFIX is passed separately > + because "long double" cannot be pasted into a "long_double_val1" > + identifier. */ > > -#define DEFINE_T_FLOAT_VALUES(TYPE, NAME) \ > +#define DEFINE_T_FLOAT_VALUES(TYPE, NAME, PREFIX) \ > int \ > NAME T_VALUES_PARAMS (TYPE) \ > { \ > - return ((arg1 - TYPE##_val1) < DELTA \ > - && (arg1 - TYPE##_val1) > -DELTA \ > - && (arg2 - TYPE##_val2) < DELTA \ > - && (arg2 - TYPE##_val2) > -DELTA); \ > + return ((arg1 - PREFIX##_val1) < DELTA \ > + && (arg1 - PREFIX##_val1) > -DELTA \ > + && (arg2 - PREFIX##_val2) < DELTA \ > + && (arg2 - PREFIX##_val2) > -DELTA); \ > } > > -DEFINE_T_FLOAT_VALUES (float, t_float_values2) > -DEFINE_T_FLOAT_VALUES (double, t_double_values) > +DEFINE_T_FLOAT_VALUES (float, t_float_values2, float) > +DEFINE_T_FLOAT_VALUES (double, t_double_values, double) > +DEFINE_T_FLOAT_VALUES (long double, t_long_double_values, ldouble) > > /* The parameter list of a t_TYPE_many_args function. Split out into > prototyped vs non-prototyped variants because a macro body cannot > @@ -394,9 +415,11 @@ DEFINE_T_FLOAT_VALUES (double, t_double_values) > test that GDB can construct the parameter save area correctly. > Note that Linux/ppc32 has 8 float registers to use for float > parameter passing and Linux/ppc64 has 13, so the number of > - arguments has to be at least 14 to contemplate these platforms. */ > + arguments has to be at least 14 to contemplate these platforms. > + PREFIX is passed separately because "long double" cannot be pasted > + into a "long_double_val1" identifier. */ > > -#define DEFINE_T_MANY_ARGS(TYPE, NAME) \ > +#define DEFINE_T_MANY_ARGS(TYPE, NAME, PREFIX) \ > TYPE \ > NAME T_MANY_ARGS_PARAMS (TYPE) \ > { \ > @@ -405,18 +428,19 @@ NAME T_MANY_ARGS_PARAMS (TYPE) \ > \ > sum_args = (f1 + f2 + f3 + f4 + f5 + f6 + f7 + f8 + f9 + f10 + f11 \ > + f12 + f13 + f14 + f15); \ > - sum_values = (TYPE##_val1 + TYPE##_val2 + TYPE##_val3 \ > - + TYPE##_val4 + TYPE##_val5 + TYPE##_val6 \ > - + TYPE##_val7 + TYPE##_val8 + TYPE##_val9 \ > - + TYPE##_val10 + TYPE##_val11 + TYPE##_val12 \ > - + TYPE##_val13 + TYPE##_val14 + TYPE##_val15); \ > + sum_values = (PREFIX##_val1 + PREFIX##_val2 + PREFIX##_val3 \ > + + PREFIX##_val4 + PREFIX##_val5 + PREFIX##_val6 \ > + + PREFIX##_val7 + PREFIX##_val8 + PREFIX##_val9 \ > + + PREFIX##_val10 + PREFIX##_val11 + PREFIX##_val12 \ > + + PREFIX##_val13 + PREFIX##_val14 + PREFIX##_val15); \ > \ > return ((sum_args - sum_values) < DELTA \ > && (sum_args - sum_values) > -DELTA); \ > } > > -DEFINE_T_MANY_ARGS (float, t_float_many_args) > -DEFINE_T_MANY_ARGS (double, t_double_many_args) > +DEFINE_T_MANY_ARGS (float, t_float_many_args, float) > +DEFINE_T_MANY_ARGS (double, t_double_many_args, double) > +DEFINE_T_MANY_ARGS (long double, t_long_double_many_args, ldouble) > > /* Various functions for _Complex types. */ > > diff --git a/gdb/testsuite/gdb.base/callfuncs.exp b/gdb/testsuite/gdb.base/callfuncs.exp > index f020100ce8b..ebc389c6b03 100644 > --- a/gdb/testsuite/gdb.base/callfuncs.exp > +++ b/gdb/testsuite/gdb.base/callfuncs.exp > @@ -136,6 +136,32 @@ proc do_function_calls {prototypes} { > > gdb_test "p t_double_many_args (double_val1, double_val2, double_val3, double_val4, double_val5, double_val6, double_val7, double_val8, double_val9, double_val10, double_val11, double_val12, double_val13, double_val14, double_val15)" " = 1" "call function with many double arguments." > > + gdb_test "p t_long_double_values(0.0,0.0)" " = 0" > + # Same, via function pointer. When the pointer type is > + # unprototyped, GDB has no parameter type to coerce the > + # arguments to, so the literals must carry the "L" suffix to > + # be passed as long double rather than double. > + if {$prototypes} { > + gdb_test "p ((int (*) (long double, long double)) t_long_double_values)(0.0,0.0)" " = 0" > + } else { > + gdb_test "p ((int (*) ()) t_long_double_values)(0.0L,0.0L)" " = 0" > + } > + > + gdb_test "p t_long_double_values(45.654,-67.66)" " = 1" > + if {$prototypes} { > + gdb_test "p ((int (*) (long double, long double)) t_long_double_values)(45.654,-67.66)" " = 1" > + } else { > + gdb_test "p ((int (*) ()) t_long_double_values)(45.654L,-67.66L)" " = 1" > + } > + > + gdb_test "p t_long_double_values(ldouble_val1,ldouble_val2)" " = 1" > + gdb_test "p t_long_double_values(45.654,ldouble_val2)" " = 1" > + gdb_test "p t_long_double_values(ldouble_val1,-67.66)" " = 1" > + > + gdb_test "p t_long_double_many_args (ldouble_val1, ldouble_val2, ldouble_val3, ldouble_val4, ldouble_val5, ldouble_val6, ldouble_val7, ldouble_val8, ldouble_val9, ldouble_val10, ldouble_val11, ldouble_val12, ldouble_val13, ldouble_val14, ldouble_val15)" \ > + " = 1" \ > + "call function with many long double arguments" > + > gdb_test "p t_double_int(99.0, 1)" " = 0" > gdb_test "p t_double_int(99.0, 99)" " = 1" > gdb_test "p t_int_double(99, 1.0)" " = 0" > -- > 2.54.0