From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D34273858C36; Tue, 26 Mar 2024 14:54:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D34273858C36 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1711464875; bh=BjycdkiOVBR6iCNChrqoSoOIphSzUEZIT1+Ck9+VV98=; h=From:To:Subject:Date:From; b=VoaeJ5vmRtzh+in0AlOYQAtFGwN6cemAeg+hf2SZHesyUSws6XVGO26T5cGiDTjQI rQSlfEeZYkEEJePe2QAgbX4i4V9q8SybICpTEX5SrALiNLdvNRknmkjNj8sGEmc4Ka Om+uijesexsOziSyayVUsz0OluMB/OxPMYITGyhQ= From: "patrick at rivosinc dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/114485] New: [14] Wrong code with -O3 -march=rv64gcv on riscv Date: Tue, 26 Mar 2024 14:54:35 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: patrick at rivosinc 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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=3D114485 Bug ID: 114485 Summary: [14] Wrong code with -O3 -march=3Drv64gcv on riscv Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: patrick at rivosinc dot com Target Milestone: --- Testcase: int b, c =3D 8, d; int e[23]; int main() { int *h =3D e; for (int i =3D 1; i < b + 21; i +=3D 2) { c *=3D -1; d =3D h[i] ? i : 0; } __builtin_printf("%u\n", c); } Commands > /scratch/tc-testing/tc-mar-25/build-rv64gcv/bin/riscv64-unknown-linux-gnu= -gcc -march=3Drv64gcv -O3 red.c -o red.out > /scratch/tc-testing/tc-mar-25/build-rv64gcv/bin/qemu-riscv64 red.out 4294967288 > /scratch/tc-testing/tc-mar-25/build-rv64gcv/bin/riscv64-unknown-linux-gnu= -gcc -march=3Drv64gcv -O2 red.c -o red.out > /scratch/tc-testing/tc-mar-25/build-rv64gcv/bin/qemu-riscv64 red.out 8 This is likely a duplicate of pr114476 (but this testcase does not require -fwrapv). Found via fuzzer=