From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 21110385701B; Wed, 13 Sep 2023 10:46:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 21110385701B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1694601966; bh=JO71BlZTwjCXZHWeh2WWPkGF4Obvz2cmOizg70TZqc8=; h=From:To:Subject:Date:From; b=FpZvulvj1TbUzix720Enq/wODfVx1XhzcbROADyE8MPyiBU/W1zrU24tN/prS+1kG FFssdMvh4HfeCLh3bAMS+cTP06JqPuGbOBl1Nx9JNcNNJmrnCWZUAGKn6PCsPTpr4p FhDWtgPjBoOchV7HswsOUCyxJ2cy7L9Z0L978S9c= From: "xry111 at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/111403] New: LoongArch: Wrong code with -O -mlasx -fopenmp-simd Date: Wed, 13 Sep 2023 10:46:05 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new 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: xry111 at gcc dot gnu.org 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=3D111403 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 =3D x.s; } S & operator=3D (const S &x) { s =3D x.s; return *this; } }; S r, a[1024], b[1024]; #pragma omp declare reduction(+ : S : omp_out.s +=3D omp_in.s) __attribute__ ((noipa)) void foo (S *a, S *b) { #pragma omp simd reduction(inscan, + : r) for (int i =3D 0; i < 1024; i++) { r.s +=3D a[i].s; #pragma omp scan inclusive(r) b[i] =3D r; } } int main () { S s; for (int i =3D 0; i < 1024; ++i) { a[i].s =3D i; b[i].s =3D -1; } foo (a, b); if (r.s !=3D 1024 * 1023 / 2) __builtin_abort (); return 0; } $ g++ t.cc -O -mlasx -fopenmp-simd $ ./a.out Aborted (core dumped)=