From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 30FF93858C50; Wed, 3 May 2023 17:45:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 30FF93858C50 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1683135952; bh=0Jiky8swUlSXLjtesyd+DvD4NgJotPU2nowHiO53rHo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=U4N3bu0B0JgF+Y8eCrcoN1J2ifJzm4Tw4qlkZXErZ0/n/9M38bGjTtCUcknRnQUGW NlB5/PUIWrJRtKTDF0ZRX14fEYfRxzoe0OpRuIWf/oWY4laImmWStUuEPsSzCKBxn7 D4m2yzbkN/Rb3R0pFHomETxoqYkW1WBYnFfqjo1o= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/109701] I have a MWE where an omp reduction breaks if I add the option for GPU offloading (even if it isn't used). Date: Wed, 03 May 2023 17:45:51 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 12.2.0 X-Bugzilla-Keywords: openmp X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID 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: resolution bug_status 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=3D109701 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |INVALID Status|UNCONFIRMED |RESOLVED CC| |jakub at gcc dot gnu.org --- Comment #5 from Jakub Jelinek --- This is a user error. The OpenMP standard makes reduction vars mapped on target only on combined constructs with the target construct, which is not the case here. If you'd use !$omp target teams distribute parallel do simd if(target:is_GPU) reduction(max:max_diff) collapse(2) then max_diff would be mapped. But as it is on a different constructs, the standard rules apply there and max_diff is firstprivatized instead (as it is scalar, no defaultmap clause is used etc.). So, if that isn't what you wan= t, you need to map it explicitly map(tofrom:max_diff) or so on the target.=