aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2022-09-16 16:40:56 +0200
committerTom de Vries <tdevries@suse.de>2022-09-16 16:40:56 +0200
commitff84aaf3e338702f982274ffb79e93562d05070c (patch)
tree327a5e0db49733193928f6b395fde12dc0c25c70 /gdb/testsuite
parent77e6e213e0c8e77c53d123244ac75d6a825bda86 (diff)
downloadgdb-ff84aaf3e338702f982274ffb79e93562d05070c.zip
gdb-ff84aaf3e338702f982274ffb79e93562d05070c.tar.gz
gdb-ff84aaf3e338702f982274ffb79e93562d05070c.tar.bz2
[gdb/tdep] Fix PowerPC IEEE 128-bit format arg passing
On a powerpc system with gcc 12 built to default to 128-bit IEEE long double, I run into: ... (gdb) print find_max_long_double_real(4, ldc1, ldc2, ldc3, ldc4)^M $8 = 0 + 0i^M (gdb) FAIL: gdb.base/varargs.exp: print \ find_max_long_double_real(4, ldc1, ldc2, ldc3, ldc4) ... This is due to incorrect handling of the argument in ppc64_sysv_abi_push_param. Fix this and similar cases, and expand the test-case to test handling of homogeneous aggregates. Tested on ppc64le-linux, power 10. Co-Authored-By: Ulrich Weigand <uweigand@de.ibm.com> Tested-by: Carl Love <cel@us.ibm.com> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29543
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/gdb.base/varargs.c28
-rw-r--r--gdb/testsuite/gdb.base/varargs.exp2
2 files changed, 30 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/varargs.c b/gdb/testsuite/gdb.base/varargs.c
index cacb29d..fcadcee 100644
--- a/gdb/testsuite/gdb.base/varargs.c
+++ b/gdb/testsuite/gdb.base/varargs.c
@@ -45,6 +45,16 @@ long double _Complex ldc2 = 2.0L + 2.0Li;
long double _Complex ldc3 = 3.0L + 3.0Li;
long double _Complex ldc4 = 4.0L + 4.0Li;
+struct sldc
+{
+ long double _Complex ldc;
+};
+
+struct sldc sldc1 = { 1.0L + 1.0Li };
+struct sldc sldc2 = { 2.0L + 2.0Li };
+struct sldc sldc3 = { 3.0L + 3.0Li };
+struct sldc sldc4 = { 4.0L + 4.0Li };
+
#endif
int
@@ -201,4 +211,22 @@ find_max_long_double_real (int num_vals, ...)
}
+long double _Complex
+find_max_struct_long_double_real (int num_vals, ...)
+{
+ long double _Complex max = 0.0L + 0.0iL;
+ struct sldc x;
+ va_list argp;
+ int i;
+
+ va_start(argp, num_vals);
+ for (i = 0; i < num_vals; i++)
+ {
+ x = va_arg (argp, struct sldc);
+ if (creall (max) < creal (x.ldc)) max = x.ldc;
+ }
+
+ return max;
+}
+
#endif /* TEST_COMPLEX */
diff --git a/gdb/testsuite/gdb.base/varargs.exp b/gdb/testsuite/gdb.base/varargs.exp
index 7bd2cb0..7fa464f 100644
--- a/gdb/testsuite/gdb.base/varargs.exp
+++ b/gdb/testsuite/gdb.base/varargs.exp
@@ -103,4 +103,6 @@ if [support_complex_tests] {
set test "print find_max_long_double_real(4, ldc1, ldc2, ldc3, ldc4)"
gdb_test $test ".*= 4 \\+ 4i"
+ set test "print find_max_struct_long_double_real(4, sldc1, sldc2, sldc3, sldc4)"
+ gdb_test $test ".*= 4 \\+ 4i"
}