From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6BEA93858C60; Thu, 9 Feb 2023 12:39:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6BEA93858C60 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1675946361; bh=L7fSjp2qL64PSWsLYCLusNrttUPQOdR2bVBZICzmWL0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Fs162PGim3y/5bJFFKtg/GU4/ZM4CtmeSgz0P7u+zNfdk5Ymr5njCPuN1aXBQrRSk 4hONaE4bfLqc4QXh82h53OPDeeS4EsH5OMI1ecSRLvmYlqzh6xTdgXKpBK/HvR5DMS V1IYLRtrHb3TKePow5/+UTTgmcsvgB5Ep1UgJUuk= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/108741] [OpenMP] Wrong code for lastprivate with pointer iteration variable Date: Thu, 09 Feb 2023 12:39:21 +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: 13.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub 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: 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=3D108741 --- Comment #1 from Jakub Jelinek --- #pragma omp simd collapse(2) lastprivate(a0,a1,j) for (a0 =3D 1; a0 <=3D 10; a0++) for (j =3D 1; j <=3D 20; j++) **a1 =3D a0; /// Segfaults here as *a0 points to invalid memory You mean *a1. That testcase is invalid, when a1 is lastprivate, it's privatized copy is uninitialized at the start and a1 is assigned the last iteration's value= .=