public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/111403] New: LoongArch: Wrong code with -O -mlasx -fopenmp-simd
@ 2023-09-13 10:46 xry111 at gcc dot gnu.org
  2023-09-13 10:48 ` [Bug target/111403] " xry111 at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: xry111 at gcc dot gnu.org @ 2023-09-13 10:46 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111403
           Summary: LoongArch: Wrong code with -O -mlasx -fopenmp-simd
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: xry111 at gcc dot gnu.org
  Target Milestone: ---

Testcase:

struct S
{
  int s;
  S () : s (0) {}
  ~S () {}
  S (const S &x) { s = x.s; }
  S &
  operator= (const S &x)
  {
    s = x.s;
    return *this;
  }
};

S r, a[1024], b[1024];

#pragma omp declare reduction(+ : S : omp_out.s += omp_in.s)

__attribute__ ((noipa)) void
foo (S *a, S *b)
{
#pragma omp simd reduction(inscan, + : r)
  for (int i = 0; i < 1024; i++)
    {
      r.s += a[i].s;
#pragma omp scan inclusive(r)
      b[i] = r;
    }
}

int
main ()
{
  S s;
  for (int i = 0; i < 1024; ++i)
    {
      a[i].s = i;
      b[i].s = -1;
    }
  foo (a, b);
  if (r.s != 1024 * 1023 / 2)
    __builtin_abort ();
  return 0;
}

$ g++ t.cc -O -mlasx -fopenmp-simd
$ ./a.out
Aborted (core dumped)

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-02-01  6:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-13 10:46 [Bug target/111403] New: LoongArch: Wrong code with -O -mlasx -fopenmp-simd xry111 at gcc dot gnu.org
2023-09-13 10:48 ` [Bug target/111403] " xry111 at gcc dot gnu.org
2023-10-08  8:45 ` guojie at loongson dot cn
2024-01-31 10:44 ` xry111 at gcc dot gnu.org
2024-01-31 16:45 ` xry111 at gcc dot gnu.org
2024-01-31 16:48 ` xry111 at gcc dot gnu.org
2024-01-31 17:17 ` schwab@linux-m68k.org
2024-01-31 17:23 ` xry111 at gcc dot gnu.org
2024-02-01  6:17 ` panchenghui at loongson dot cn

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).