From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5A2623897A36; Wed, 31 Aug 2022 02:16:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5A2623897A36 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1661912185; bh=d9dAjyAWIIecQjOa3DChZbtX26MyGZ9aaXg9WdPZiQg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=aOjFJovAImaPu7s3GLtCSzUhCUbAX3ZQFJ9UikOiAaeF9FGH+JSpuJgd4eoKOmXlQ Uvbj7OxPNyKdSyDNJGNbhogiw5+8r3jpwdCpVA6fQucONw82Sd0AQyRKtyZFfFWXy3 8pxLeGLljib5Nn5jocnkyynCM6aoDbcT2qz8RtPQ= From: "hberre3 at gatech dot edu" To: gcc-bugs@gcc.gnu.org Subject: [Bug libgomp/106643] [gfortran + OpenACC] Allocate in module causes refcount error Date: Wed, 31 Aug 2022 02:16:24 +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: 13.0 X-Bugzilla-Keywords: openacc X-Bugzilla-Severity: normal X-Bugzilla-Who: hberre3 at gatech dot edu 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=3D106643 --- Comment #1 from Henry Le Berre --- Here is a more minimal version: m_mod.f90: ```fortran module m_mod real(kind(0d0)),allocatable, dimension(:) :: arrs !$acc declare create(arrs) contains subroutine s_mod_init() allocate(arrs(10)) !$acc enter data create(arrs(10)) !$acc update device(arrs(10)) !$acc exit data delete(arrs) end subroutine s_mod_init end module m_mod ``` p_main.f90: ``` program p_main use m_mod call s_mod_init() end program p_main ``` Here is a C version that runs without issue: m_mod.c: ``` #include #include double* arrs; #pragma acc declare create(arrs) void m_mod_init() { arrs =3D (double*)malloc(10*sizeof(double)); #pragma acc enter data create(arrs[0:9]) #pragma acc update device(arrs[0:9]) #pragma acc exit data delete(arrs) } ``` p_main.c: ``` extern void m_mod_init(); int main() { m_mod_init();=20 } ```=