From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id ABED63858C74; Sun, 10 Dec 2023 12:41:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ABED63858C74 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1702212103; bh=wUWzCkPJyj0xU5h8bxSPL3Z4vtsB9D/TtOZEb4eUHtc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=yqmxAYGmwFWUQoP/rfpzwPO81A9fS+9XszwC7sIl7O7mXaAJKlVm9LlQI5sL2Rfbv LIB1R+nHJtBjTCwr0mSHlSjJ7PzGbgq8LWRYqpfDeYdB9yCDnPI67RXWqGKIPpX6+m AB4Ffsvwx+LYCTPS1v1KnLkQyBuDUiieI6z0fj48= From: "pan2.li at intel dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/112929] [14] RISC-V vector: Variable clobbered at runtime Date: Sun, 10 Dec 2023 12:41:42 +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: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: pan2.li at intel dot com X-Bugzilla-Status: UNCONFIRMED 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: cc 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=3D112929 Li Pan changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pan2.li at intel dot com --- Comment #11 from Li Pan --- (In reply to JuzheZhong from comment #8) > Li Pan will investigate it. He will note me if there is a bug in vsetvl p= ass. The interesting thing is that I cannot fully reproduce this with build 20231210. PASS >> ../build-qemu/qemu-riscv64 -cpu rv64,vlen=3D128,v=3Dtrue,vext_spec= =3Dv1.0 test.rv64gc.elf FAIL ../build-qemu/qemu-riscv64 -cpu rv64,vlen=3D128,v=3Dtrue,vext_spec=3Dv= 1.0 test.gcv.elf Segmentation fault (core dumped) It will be PASS if built with rv64gc but got a segment fault in printf when built with rv64gcv. Thus I did some adjusting for this case to bypass the segment, and then have the rv64gcv pass. Update the modified test case as below. qemu-riscv64 version 8.1.92 (v8.2.0-rc2-48-gd451e32ce8). newlib for gcc build. Modified test case: int a, b, l, i, p, q, t, n, o; int *volatile c; static int j; static struct pack_1_struct d; long e; char m =3D 5; short s; #pragma pack(1) struct pack_1_struct { long c; int d; int e; int f; int g; int h; int i; } h, r =3D {1}, *f =3D &h, *volatile g; int main() { int u; j =3D 0; for (; j < 9; ++j) { u =3D ++t ? a : 0; if (u) { int *v =3D &d.d; *v =3D g || e; *c =3D 0; *f =3D h; } s =3D l && c; o =3D i; d.f || (p =3D 0); q |=3D n; } r =3D *f; if (m =3D=3D 5) // Reference m like print return 0; return 1234; }=