From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 04E233858C5F; Thu, 29 Feb 2024 21:28:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 04E233858C5F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1709242105; bh=9N4xrJUcL4X1xCX4d1OgxFhM0jdJYJ1O44inBCvOIhg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=IijMGtXPiUzP4zZHnJtw2uAkPFQdzaAUqIyycXxoXQ0fno0hYrs1LG3GklF9fB2k4 sySviIDKC+SeaaO8oUuSpeiyG43oXxKf6jKhnHhEMgxJbqiY6vgdH9zFMsCtZs0lHO tCHoNcF6vnDuHRIO2rMBFdIHwGUENBtbby5QzLWE= From: "palmer at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/114175] [13/14] RISC-V: Execution test failures on gcc.dg/c23-stdarg-6.c Date: Thu, 29 Feb 2024 21:28:23 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: palmer at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cf_reconfirmed_on everconfirmed bug_status Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D114175 palmer at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2024-02-29 Ever confirmed|0 |1 Status|UNCONFIRMED |NEW --- Comment #14 from palmer at gcc dot gnu.org --- Looks like it's a problem with the struct return argument mixing with va_st= art / va_arg. This much smaller test case still fails, and on gcc-13 $ cat gcc/testsuite/gcc.dg/c23-stdarg-6.c /* Test C23 variadic functions with no named parameters, or last named parameter with a declaration not allowed in C17. Execution tests. */ /* { dg-do run } */ /* { dg-options "-std=3Dc23 -pedantic-errors" } */ #include #include extern void abort (void); extern void exit (int); struct s { char c[1000]; }; struct s f (...) { va_list ap; va_start (ap); double r =3D va_arg (ap, int); va_end (ap); struct s ret =3D {}; ret.c[0] =3D r; ret.c[999] =3D 42; return ret; } int main () { struct s x =3D f (1); fprintf(stderr, "%d\n", x.c[0]); if (x.c[0] !=3D 1) abort (); exit (0); } $ riscv64-unknown-linux-gnu-gcc gcc/testsuite/gcc.dg/c23-stdarg-6.c -o test -std=3Dc2x -static -O3 $ qemu-riscv64 ./test 16 Aborted The output value seems to change from time to time, which smells like some uninitialized access. I'd bet we're just not properly skipping over the ou= tput stack space in riscv_va_start(). Not quite sure where to start, though, as ours is so much simpler than arm64 that it's going to take a bit to figure = out what's going on.=