https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114175

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[14] RISC-V: Execution test |[13/14] RISC-V: Execution
                   |failures on                 |test failures on
                   |gcc.dg/c23-stdarg-6.c       |gcc.dg/c23-stdarg-6.c
                 CC|                            |law at gcc dot gnu.org

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Seems for both
--- c23-stdarg-6.c      2024-02-28 09:26:37.091973617 +0100
+++ c23-stdarg-6a.c     2024-02-29 20:45:55.498685963 +0100
@@ -9,8 +9,8 @@ extern void abort (void);
 extern void exit (int);
 struct s { char c[1000]; };

-struct s
-f (...)
+void
+f (struct s *ret, ...)
 {
   va_list ap;
   va_start (ap);
@@ -19,10 +19,9 @@ f (...)
   r += va_arg (ap, int);
   r += va_arg (ap, double);
   va_end (ap);
-  struct s ret = {};
-  ret.c[0] = r;
-  ret.c[999] = 42;
-  return ret;
+  __builtin_memset (ret, 0, sizeof (*ret));
+  ret->c[0] = r;
+  ret->c[999] = 42;
 }

 struct s
@@ -183,7 +182,8 @@ h7 (volatile struct s x, ...)
 int
 main ()
 {
-  struct s x = f (1, 2.0, 3, 4.0);
+  struct s x;
+  f (&x, 1, 2.0, 3, 4.0);
   if (x.c[0] != 10 || x.c[999] != 42)
     abort ();
   x = g (0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0);

The arguments are passed in by the caller in a0 (the hidden struct pointer or
explicit in the other one), a1 (1), a2+a3 (2.0), a4 (3), a5+a6 (4.0).
But __floatsidf is called with original a0 in the original testcase (wrong),
while a1 in the modified.
Anyway, I doubt GCC 13 behaves different from the trunk, so there just hasn't
been a testcase for the wrong-code issue before.

Reply via email to