From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 66390 invoked by alias); 28 Jun 2016 19:16:32 -0000 Mailing-List: contact fortran-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: fortran-owner@gcc.gnu.org Received: (qmail 66380 invoked by uid 89); 28 Jun 2016 19:16:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.0 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=association, PARALLEL, INTENT, DOES X-HELO: moene.org Received: from moene.org (HELO moene.org) (80.101.130.238) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 28 Jun 2016 19:16:22 +0000 Received: from [::1] (helo=moene.org) by moene.org with esmtp (Exim 4.87) (envelope-from ) id 1bHyUb-0000gd-Cs for fortran@gcc.gnu.org; Tue, 28 Jun 2016 21:16:17 +0200 Subject: Fwd: This OpenMP code doesn't seem to compile correctly (5.4, 6.1). References: To: fortran@gcc.gnu.org From: Toon Moene X-Forwarded-Message-Id: Message-ID: Date: Tue, 28 Jun 2016 19:16:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------3BB0EB21D45CE4F33DD5C280" X-IsSubscribed: yes X-SW-Source: 2016-06/txt/msg00111.txt.bz2 This is a multi-part message in MIME format. --------------3BB0EB21D45CE4F33DD5C280 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-length: 776 -------- Forwarded Message -------- Subject: This OpenMP code doesn't seem to compile correctly (5.4, 6.1). Date: Tue, 28 Jun 2016 21:13:43 +0200 From: Toon Moene Organization: Moene Computational Physics, Maartensdijk, The Netherlands To: fortran@gcc.gn.org See the attached. I can't find fault with the code, yet it produces: 99999.0000 99999.0000 99999.0000 99999.0000 instead of zeros. Is this indeed an error (in that case I will open a BugZilla report). Kind regards, -- Toon Moene - e-mail: toon@moene.org - phone: +31 346 214290 Saturnushof 14, 3738 XG Maartensdijk, The Netherlands At home: http://moene.org/~toon/; weather: http://moene.org/~hirlam/ Progress of GNU Fortran: http://gcc.gnu.org/wiki/GFortran#news --------------3BB0EB21D45CE4F33DD5C280 Content-Type: text/x-fortran; name="elkhatib.f90" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="elkhatib.f90" Content-length: 1179 MODULE MYFIELDS_MOD ! The definition of a derived type containing an allocatable array IMPLICIT NONE SAVE TYPE :: MYFIELDS REAL, ALLOCATABLE :: GMVT1S(:) END TYPE MYFIELDS END MODULE MYFIELDS_MOD PROGRAM GP_MODEL ! A program to allocate then use a structure containing a allocatable array USE MYFIELDS_MOD , ONLY : MYFIELDS IMPLICIT NONE TYPE(MYFIELDS) :: YRFIELDS ALLOCATE(YRFIELDS%GMVT1S(4)) YRFIELDS%GMVT1S=99999. CALL GP_TEST(YRFIELDS) END PROGRAM GP_MODEL SUBROUTINE GP_TEST(YDFIELDS) ! A subroutine to initialize the component of a structure, which is an ! allocatable array, via an association ! DOES NOT WORK SINCE GFORTRAN 4.9.2 (4.9.1 ?), UNLESS ONE OF THE FOLLOWING CONDITIONS IS RESPECTED : ! - Open-mp is disabled ! - the attribute is POINTER instead of ALLOCATABLE ! - the association is not used ! COULD BE AN ISSUE WITH Version 4.0 of the OpenMP specification USE MYFIELDS_MOD , ONLY : MYFIELDS IMPLICIT NONE TYPE(MYFIELDS), INTENT(INOUT) :: YDFIELDS INTEGER :: J ASSOCIATE(YDGMV=>YDFIELDS) !$OMP PARALLEL DO DO J=1,4 YDGMV%GMVT1S(J)=0. ENDDO !$OMP END PARALLEL DO print*,YDFIELDS%GMVT1S(:) END ASSOCIATE END SUBROUTINE GP_TEST --------------3BB0EB21D45CE4F33DD5C280--