public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/27916] New: Problem with allocatable arrays inside OpenMP do loop
@ 2006-06-06 12:01 benjamin dot reveille at gmail dot com
2006-06-06 12:10 ` [Bug fortran/27916] " benjamin dot reveille at gmail dot com
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: benjamin dot reveille at gmail dot com @ 2006-06-06 12:01 UTC (permalink / raw)
To: gcc-bugs
I've stumbled on a gfortran "Fortran runtime error" when using allocatable
arrays inside OpenMP PARALLEL DO LOOPS
Consider the folowing reduced testcase.
>> cat allocate_in_loop.f90
program allocate_in_loop
use omp_lib, only: omp_get_num_threads,omp_get_thread_num
implicit none
integer :: numthreads,n,it,i
integer, dimension(:), allocatable :: int_array
!
!$OMP PARALLEL DEFAULT(shared) NUM_THREADS(4)
numthreads=omp_get_num_threads()
!$OMP DO PRIVATE(n,it,int_array,i) SCHEDULE(static)
do n=1,numthreads
it=omp_get_thread_num()
allocate(int_array(3))
do i=1,3
int_array(i)=(it)*100+i
write(*,'(a,i2,a,i1,a,i4)') 'thread :',it,' -->int_array(', &
i,')=',int_array(i)
end do
deallocate(int_array)
end do
!$OMP END DO
!
!$OMP END PARALLEL
end program allocate_in_loop
According to what I read in the OpenMP 2.5 Specification - in sections 2.8.3.3
page 75 - the usage of the allocatable array is correct since I allocate it and
deallocate inside the OMP loop and it is not allocated upon entering the OMP DO
loop.
Gfortran compile fine with
>> gfortran -fopenmp allocate_in_loop.f90
But fails on execution with: "Fortran runtime error: Attempting to allocate
already allocated array."
intel 9.1, pgi 6.1 and xl do fine, the output being for example...
>> ./a.out
thread : 0 --> int_array(1)= 1
thread : 0 --> int_array(2)= 2
thread : 0 --> int_array(3)= 3
thread : 1 --> int_array(1)= 101
thread : 1 --> int_array(2)= 102
thread : 1 --> int_array(3)= 103
thread : 2 --> int_array(1)= 201
thread : 2 --> int_array(2)= 202
thread : 2 --> int_array(3)= 203
thread : 3 --> int_array(1)= 301
thread : 3 --> int_array(2)= 302
thread : 3 --> int_array(3)= 303
Good bug squashing
Benjamin
--
Summary: Problem with allocatable arrays inside OpenMP do loop
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: benjamin dot reveille at gmail dot com
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27916
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/27916] Problem with allocatable arrays inside OpenMP do loop
2006-06-06 12:01 [Bug fortran/27916] New: Problem with allocatable arrays inside OpenMP do loop benjamin dot reveille at gmail dot com
@ 2006-06-06 12:10 ` benjamin dot reveille at gmail dot com
2006-06-08 15:02 ` jakub at gcc dot gnu dot org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: benjamin dot reveille at gmail dot com @ 2006-06-06 12:10 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from benjamin dot reveille at gmail dot com 2006-06-06 12:01 -------
For the fortran mailing list thread on this bug see:
http://gcc.gnu.org/ml/fortran/2006-06/msg00096.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27916
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/27916] Problem with allocatable arrays inside OpenMP do loop
2006-06-06 12:01 [Bug fortran/27916] New: Problem with allocatable arrays inside OpenMP do loop benjamin dot reveille at gmail dot com
2006-06-06 12:10 ` [Bug fortran/27916] " benjamin dot reveille at gmail dot com
@ 2006-06-08 15:02 ` jakub at gcc dot gnu dot org
2006-06-09 21:26 ` jakub at gcc dot gnu dot org
2006-06-09 21:26 ` jakub at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu dot org @ 2006-06-08 15:02 UTC (permalink / raw)
To: gcc-bugs
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |jakub at gcc dot gnu dot org
|dot org |
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2006-06-08 14:46:16
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27916
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/27916] Problem with allocatable arrays inside OpenMP do loop
2006-06-06 12:01 [Bug fortran/27916] New: Problem with allocatable arrays inside OpenMP do loop benjamin dot reveille at gmail dot com
` (2 preceding siblings ...)
2006-06-09 21:26 ` jakub at gcc dot gnu dot org
@ 2006-06-09 21:26 ` jakub at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu dot org @ 2006-06-09 21:26 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from jakub at gcc dot gnu dot org 2006-06-09 21:25 -------
Should be fixed in SVN.
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27916
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/27916] Problem with allocatable arrays inside OpenMP do loop
2006-06-06 12:01 [Bug fortran/27916] New: Problem with allocatable arrays inside OpenMP do loop benjamin dot reveille at gmail dot com
2006-06-06 12:10 ` [Bug fortran/27916] " benjamin dot reveille at gmail dot com
2006-06-08 15:02 ` jakub at gcc dot gnu dot org
@ 2006-06-09 21:26 ` jakub at gcc dot gnu dot org
2006-06-09 21:26 ` jakub at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu dot org @ 2006-06-09 21:26 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from jakub at gcc dot gnu dot org 2006-06-09 21:18 -------
Subject: Bug 27916
Author: jakub
Date: Fri Jun 9 21:18:42 2006
New Revision: 114520
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=114520
Log:
PR fortran/27916
* trans-openmp.c (gfc_omp_clause_default_ctor): New function.
* trans.h (gfc_omp_clause_default_ctor): New prototype.
* f95-lang.c (LANG_HOOKS_OMP_CLAUSE_DEFAULT_CTOR): Define.
* testsuite/libgomp.fortran/pr27916-1.f90: New test.
* testsuite/libgomp.fortran/pr27916-2.f90: New test.
Added:
trunk/libgomp/testsuite/libgomp.fortran/pr27916-1.f90
trunk/libgomp/testsuite/libgomp.fortran/pr27916-2.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/f95-lang.c
trunk/gcc/fortran/trans-openmp.c
trunk/gcc/fortran/trans.h
trunk/libgomp/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27916
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-06-09 21:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-06 12:01 [Bug fortran/27916] New: Problem with allocatable arrays inside OpenMP do loop benjamin dot reveille at gmail dot com
2006-06-06 12:10 ` [Bug fortran/27916] " benjamin dot reveille at gmail dot com
2006-06-08 15:02 ` jakub at gcc dot gnu dot org
2006-06-09 21:26 ` jakub at gcc dot gnu dot org
2006-06-09 21:26 ` jakub at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).