aboutsummaryrefslogtreecommitdiffstats
path: root/test/regression
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@college-de-france.fr>2021-01-10 14:34:58 +0100
committerXavier Leroy <xavier.leroy@college-de-france.fr>2021-01-10 15:58:46 +0100
commite81d015e3cc2cb0c352792d0cac12f1594281bc2 (patch)
tree27a114153d1af7ba2771422780d452e5cb776daa /test/regression
parent35e2b11db8d5b79a09e6d69dd68b54d3a51ba2d5 (diff)
downloadcompcert-kvx-e81d015e3cc2cb0c352792d0cac12f1594281bc2.tar.gz
compcert-kvx-e81d015e3cc2cb0c352792d0cac12f1594281bc2.zip
RISC-V: wrong fixup code generated for vararg calls with fixed FP args
This is a follow-up to 2076a3bb3. Integer registers were wrongly reserved for fixed FP arguments, causing variadic FP arguments to end up in the wrong integer registers. Added regression test in test/regression/varargs2.c
Diffstat (limited to 'test/regression')
-rw-r--r--test/regression/Results/varargs21
-rw-r--r--test/regression/varargs2.c16
2 files changed, 17 insertions, 0 deletions
diff --git a/test/regression/Results/varargs2 b/test/regression/Results/varargs2
index 96ee9d63..050b6331 100644
--- a/test/regression/Results/varargs2
+++ b/test/regression/Results/varargs2
@@ -10,4 +10,5 @@ Twice: -1 1.23
With va_copy: -1 1.23
With va_copy: -1 1.23
With extra args: x & Hello, world! & 42 & 123456789012345 & 3.141592654 & 2.718281746
+With extra FP args: 123456789012345 & 3.141592654 & 2.718281746
va_list compatibility: x & Hello, world! & 42 & 123456789012345 & 3.141592654 & 2.718281746
diff --git a/test/regression/varargs2.c b/test/regression/varargs2.c
index b96d1940..32140d5c 100644
--- a/test/regression/varargs2.c
+++ b/test/regression/varargs2.c
@@ -104,6 +104,17 @@ void miniprintf_extra(int i1, int i2, int i3, int i4,
va_end(va);
}
+/* Add a few dummy FP arguments to test passing of variadic FP arguments
+ in integer registers (mostly relevant for RISC-V) */
+
+void miniprintf_float(double f1, double f2, const char * fmt, ...)
+{
+ va_list va;
+ va_start(va, fmt);
+ minivprintf(fmt, va);
+ va_end(va);
+}
+
/* Test va_list compatibility with the C library */
void printf_compat(const char * fmt, ...)
@@ -143,6 +154,11 @@ int main()
123456789012345LL,
3.141592654,
2.71828182);
+ miniprintf_float(0.0, 1.0,
+ "With extra FP args: %l & %e & %f\n",
+ 123456789012345LL,
+ 3.141592654,
+ 2.71828182);
printf_compat("va_list compatibility: %c & %s & %d & %lld & %.10g & %.10g\n",
'x',
"Hello, world!",