From: Pedro Alves <pedro@palves.net>
To: gdb-patches@sourceware.org
Subject: [PATCH 1/4] gdb.base/nodebug.exp: Add long double testing
Date: Tue, 14 Jul 2026 23:06:28 +0100 [thread overview]
Message-ID: <20260714220631.1499846-2-pedro@palves.net> (raw)
In-Reply-To: <20260714220631.1499846-1-pedro@palves.net>
gdb.base/nodebug.exp is missing testing calling long double functions.
This commit adds such tests.
With a GDB that doesn't know that "long double" is 64-bit on
x86_64-pc-windows-msvc, we get:
FAIL: gdb.base/nodebug.exp: p (long double) mult_long_double(2.0L, 3.0L)
FAIL: gdb.base/nodebug.exp: p ((long double (*) (long double, long double)) mult_long_double)(2.0L, 3.0L)
FAIL: gdb.base/nodebug.exp: p ((long double (*) (long double, long double)) mult_long_double)(2, 3)
FAIL: gdb.base/nodebug.exp: p ((long double (*) ()) mult_long_double_noproto)(2.0L, 3.0L)
Passes cleanly on:
- x86_64-pc-linux-gnu
- x86_64-w64-mingw32
- x86_64-pc-windows-msvc, with the "long double" fix
Change-Id: If9ee749187e1d30fedcba17ae12634f3bd90de2f
---
gdb/testsuite/gdb.base/nodebug.c | 13 +++++++++++++
gdb/testsuite/gdb.base/nodebug.exp | 6 ++++++
2 files changed, 19 insertions(+)
diff --git a/gdb/testsuite/gdb.base/nodebug.c b/gdb/testsuite/gdb.base/nodebug.c
index c7bc93991b8..275a9d6ff60 100644
--- a/gdb/testsuite/gdb.base/nodebug.c
+++ b/gdb/testsuite/gdb.base/nodebug.c
@@ -72,6 +72,12 @@ mult (double v1, double v2)
return v1 * v2;
}
+long double
+mult_long_double (long double v1, long double v2)
+{
+ return v1 * v2;
+}
+
double
mult_noproto (v1, v2)
double v1, v2;
@@ -79,6 +85,13 @@ mult_noproto (v1, v2)
return v1 * v2;
}
+long double
+mult_long_double_noproto (v1, v2)
+ long double v1, v2;
+{
+ return v1 * v2;
+}
+
uint8_t
add8 (uint8_t v1, uint8_t v2)
{
diff --git a/gdb/testsuite/gdb.base/nodebug.exp b/gdb/testsuite/gdb.base/nodebug.exp
index e4138a801da..1a16e86ed2c 100644
--- a/gdb/testsuite/gdb.base/nodebug.exp
+++ b/gdb/testsuite/gdb.base/nodebug.exp
@@ -78,6 +78,12 @@ proc test_call_promotion {} {
gdb_test "p ((double (*) ()) mult_noproto)(2.0f, 3.0f)" " = 6"
gdb_test "p ((double (*) ()) mult_noproto)(2.0, 3.0)" " = 6"
+ # Same, but for long double.
+ gdb_test "p (long double) mult_long_double(2.0L, 3.0L)" " = 6"
+ gdb_test "p ((long double (*) (long double, long double)) mult_long_double)(2.0L, 3.0L)" " = 6"
+ gdb_test "p ((long double (*) (long double, long double)) mult_long_double)(2, 3)" " = 6"
+ gdb_test "p ((long double (*) ()) mult_long_double_noproto)(2.0L, 3.0L)" " = 6"
+
# Check that GDB promotes char->int correctly.
gdb_test "p /d (uint8) add8((uint8) 2, (uint8) 3)" " = 5"
gdb_test "p /d ((uint8 (*) (uint8, uint8)) add8)((uint8) 2, (uint8) 3)" " = 5"
--
2.54.0
next prev parent reply other threads:[~2026-07-14 22:07 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-14 22:06 [PATCH 0/4] gdb/testsuite: "long double" infcall tests Pedro Alves
2026-07-14 22:06 ` Pedro Alves [this message]
2026-07-16 21:14 ` [PATCH 1/4] gdb.base/nodebug.exp: Add long double testing Andrew Burgess
2026-07-17 13:59 ` Pedro Alves
2026-07-22 18:41 ` Andrew Burgess
2026-07-14 22:06 ` [PATCH 2/4] gdb.base/callfuncs.exp: Adjust for Windows Pedro Alves
2026-07-14 22:25 ` Pedro Alves
2026-07-16 21:26 ` Andrew Burgess
2026-07-17 14:27 ` Pedro Alves
2026-07-22 18:42 ` Andrew Burgess
2026-07-14 22:06 ` [PATCH 3/4] gdb.base/callfuncs.c: factor out float/double functions Pedro Alves
2026-07-16 21:33 ` Andrew Burgess
2026-07-14 22:06 ` [PATCH 4/4] gdb.base/callfuncs.exp: Exercise "long double" Pedro Alves
2026-07-16 21:36 ` Andrew Burgess
2026-07-22 13:01 ` [PATCH 0/4] gdb/testsuite: "long double" infcall tests Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260714220631.1499846-2-pedro@palves.net \
--to=pedro@palves.net \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox