From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3FF473858D38; Wed, 21 Feb 2024 17:59:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3FF473858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1708538399; bh=tw+qJxC8GvLXqN9zKM+RLo2bZOH3aGntvncWU5JdcCw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=eFtgpfkw70e0GvGSsUV1wFofPOLIM3uieg59K4vrSn+HKR1X3uK195uIdh+uE9IGF rNZ8DAnIqbZHx0dWIaG8/7IKnzMMvH4UQZTSEOfo77nFzTlX8E6P65DRg+T1FJa/s/ GhPsEqfV7xYhxA6Pddkpy9tVaaDeOYCvBpkEY0MU= From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libgomp/113867] [14 Regression][OpenMP] Wrong code with mapping pointers in structs Date: Wed, 21 Feb 2024 17:59:58 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libgomp X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: openmp, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: burnus at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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=3D113867 --- Comment #5 from Tobias Burnus --- For: int *q; #pragma omp target device(y5) map(q, q[:5]) GCC currently generates: map(tofrom:q [len: 8]) map(tofrom:*q.4_1 [len: 20]) map(attach:q [bias: 0= ]) Expected: 'alloc:' instead of 'attach:' or even: map(tofrom:*q [len: 20]) map(firstprivate:q [pointer assign, bias: 0]) In any case, the first 'tofrom' is pointless! NOTE: GCC 13 shows: error: 'q' appears both in data and map clauses * * * For #pragma omp target map(s.p[:5]) GCC should do: map(tofrom:s [len: 24][implicit]) map(tofrom:*_5 [len: 16]) map(attach:s.p [bias: 0]) But (regression!) it does: map(struct:s [len: 1]) map(alloc:s.p [len: 8]) map(tofrom:*_5 [len: 16]) map(attach:s.p [bias: 0]) Solution: --- a/gcc/gimplify.cc +++ b/gcc/gimplify.cc @@ -12381,3 +12381,4 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p, if (OMP_CLAUSE_MAP_KIND (c) =3D=3D GOMP_MAP_ATTACH - || OMP_CLAUSE_MAP_KIND (c) =3D=3D GOMP_MAP_DETACH) + || OMP_CLAUSE_MAP_KIND (c) =3D=3D GOMP_MAP_DETACH + || OMP_CLAUSE_MAP_KIND (c) =3D=3D GOMP_MAP_ATTACH_DETACH) break; However, unless I messed up, this will cause tons of ICE(segfault).=