public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "patrick at rivosinc dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/113209] New: [14] RISC-V rv64gcv_zvl256b vector: Runtime mismatch with rv64gc
Date: Tue, 02 Jan 2024 21:48:52 +0000	[thread overview]
Message-ID: <bug-113209-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 113209
           Summary: [14] RISC-V rv64gcv_zvl256b vector: Runtime mismatch
                    with rv64gc
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: patrick at rivosinc dot com
  Target Milestone: ---

Testcase:
int b, c, d, f, i, a;
int e[1] = {0};
int *g = e;
int *k = e;
int *z;
long h;
int j[5] = {0,0,0,0,0};
void n() {
  if (c) {
    int **l = &z;
    *l = e;
    while (d)
      ;
  }
}
void o() {
  for (; b < 5; b += a) {
    n();
    for (h = 0; h < 5; h++)
      j[h] = 1;
    int m = *e != *g;
    a |= i <= m;
    f = -12;
    for (; f; f++)
      if (*k)
        break;
  }
}
int main() {
  o();
  if (a == 1)
    return 0;
  else
    return 1;
}

Commands:
> /scratch/tc-testing/tc-jan-1-trunk/build-rv64gcv/bin/riscv64-unknown-linux-gnu-gcc -march=rv64gcv_zvl256b -O3 red.c -o user-config.out
> QEMU_CPU=rv64,vlen=256,v=true,vext_spec=v1.0,Zve32f=true,Zve64f=true timeout --verbose -k 0.1 1 /scratch/tc-testing/tc-dec-22-trunk/build-rv64gcv/bin/qemu-riscv64 user-config.out
> echo $?
1

> /scratch/tc-testing/tc-jan-1-trunk/build-rv64gcv/bin/riscv64-unknown-linux-gnu-gcc -march=rv64gc -O3 red.c -o user-config.out
> QEMU_CPU=rv64,vlen=256,v=true,vext_spec=v1.0,Zve32f=true,Zve64f=true timeout --verbose -k 0.1 1 /scratch/tc-testing/tc-dec-22-trunk/build-rv64gcv/bin/qemu-riscv64 user-config.out
> echo $?
0

With a printf:
gcv_zvl256b
a = 9

gc
a = 1

Analysis:
Working backwards from a
a |= i <= m
Since true/false only evaluate to 1/0, 'a' should never be 9

             reply	other threads:[~2024-01-02 21:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-02 21:48 patrick at rivosinc dot com [this message]
2024-01-04  0:33 ` [Bug target/113209] " cvs-commit at gcc dot gnu.org
2024-01-04  1:37 ` patrick at rivosinc dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-113209-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).