public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/32467]  New: STRUCTURE CONTAINING ALLOCATABLE ARRAY 'A' APPEARS IN COPYIN CLAUSE
@ 2007-06-22 19:43 longb at cray dot com
  2007-06-22 20:28 ` [Bug fortran/32467] structure containing allocatable array is accepted in COPYIN clause dfranke at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: longb at cray dot com @ 2007-06-22 19:43 UTC (permalink / raw)
  To: gcc-bugs

Description:
This negative test case was derived from OpenMP test omp1/F2_6_1_5a.f90.  On
p. 85 of the OpenMP API Version 2.5 May 2005 line 22 states:

"* Allocatable arrays may not appear in a copyin clause."

The structure struct1 is made up of an allocatable array a.  The structure
appears in a threadprivate directive and in a copyin clause.  This error
should probably be detected at compile-time.

> gfortran -v
Using built-in specs.
Target: x86_64-suse-linux
Configured with: ../xt-gcc-4.2.0/configure --prefix=/opt/gcc/4.2.0/snos
--disable-nls --libdir=/opt/gcc/4.2.0/snos/lib --enable-languages=c,c++,fortran
--with-gxx-include-dir=/opt/gcc/4.2.0/snos/include/g++
--with-slibdir=/opt/gcc/4.2.0/snos/lib --with-system-zlib --enable-shared
--enable-__cxa_atexit x86_64-suse-linux
Thread model: posix
gcc version 4.2.0 20070514 (rpm:4)


> cat bug2832.f90
! Derived from OpenMP test omp1/F2_6_1_5a.f90
      use omp_lib
      implicit none
      integer, parameter :: NT = 4
      integer :: nThreads(NT)
      type structure_1
          integer, allocatable :: a(:)
      end type structure_1
      type(structure_1),save :: struc1
!$omp threadprivate(struc1)

!$    call omp_set_dynamic(.true.)
!$    call omp_set_num_threads(NT)
      allocate(struc1 % a(2))
      struc1 % a(1) = 1
      struc1 % a(2) = 2

!$omp parallel copyin(struc1)
      nThreads(omp_get_thread_num()+1) = struc1 % a(1)
!$omp end parallel

      print *, nThreads
      deallocate(struc1 % a)
      END

> ftn -O3 -fopenmp -o x bug2832.f90
/opt/xt-pe/2.1/bin/snos64/ftn: INFO: linux target is being used
> aprun -n 1 ./x
           1           0           0           0
Application 217647 resources: utime 0, stime 0

NOTE: A compile-time message rejecting the use of struc1 in copyin is expected.
Or, the restriction imposed by the API version 2.5 should be ignored and the
correct answer produced, which is four 1's.

------
Note: ftn is an alias for:

/opt/gcc/4.2.0/bin/../snos/bin/gfortran -static -v
-I/opt/xt-mpt/2.1/mpich2-64/GP/include -I/opt/xt-mpt/2.1/mpich2-64/GP/include
-L/opt/xt-mpt/2.1/mpich2-64/GP/lib -I/opt/acml/3.6.1/gnu64/include
-I/opt/xt-libsci/10.1.0/gnu/snos64/include
-I/opt/xt-libsci/10.1.0/gnu/snos64/include/superlu
-I/opt/xt-mpt/2.1/sma/P/include -L/opt/acml/3.6.1/gnu64/lib
-L/opt/xt-libsci/10.1.0/gnu/snos64/lib -L/opt/xt-mpt/2.1/sma/P/lib -lmpichf90
-lsci -lacml -lsma -lmpichf90 -lmpich -lrt -D__CRAYXT_COMPUTE_LINUX_TARGET
-D__TARGET_LINUX__ -fno-second-underscore
-I/notbackedup/users/rsrel/rs64.DEV.070604.Mon/install/include
-I/opt/xt-catamount/2.1/catamount/linux/include -I/opt/xt-service/2.1/include
-L/notbackedup/users/rsrel/rs64.DEV.070604.Mon/install/lib/snos64
-L/opt/xt-pe/2.1/cnos/linux/64/lib -L/opt/xt-mpt/2.1/lib/snos64
-L/opt/xt-service/2.1/lib/snos64 -Wl,--start -lpct -lalpslli -lalpsutil
-lportals -lpthread -Wl,--end -lgfortranbegin -lgfortran -lm


-- 
           Summary: STRUCTURE CONTAINING ALLOCATABLE ARRAY 'A' APPEARS IN
                    COPYIN CLAUSE
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: longb at cray dot com
 GCC build triplet: x86_64-suse-linux
  GCC host triplet: x86_64-suse-linux
GCC target triplet: x86_64-suse-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32467


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/32467] structure containing allocatable array is accepted in COPYIN clause
  2007-06-22 19:43 [Bug fortran/32467] New: STRUCTURE CONTAINING ALLOCATABLE ARRAY 'A' APPEARS IN COPYIN CLAUSE longb at cray dot com
@ 2007-06-22 20:28 ` dfranke at gcc dot gnu dot org
  2007-06-22 20:39 ` dfranke at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-06-22 20:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from dfranke at gcc dot gnu dot org  2007-06-22 20:28 -------
Reduced testcase:

$> cat pr32467.f90
use omp_lib
integer, save, allocatable :: a(:)
!$omp threadprivate(a)
allocate(a(2))
a = 1
!$omp parallel copyin(a)
print *, a(1)
!$omp end parallel
deallocate(a)
end

This code is accepted by gfortran and ifort alike, but rejected by sunf95.
the original code with allocatable array components is accepted by sunf95 as
well.


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dfranke at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
  GCC build triplet|x86_64-suse-linux           |
   GCC host triplet|x86_64-suse-linux           |
 GCC target triplet|x86_64-suse-linux           |
           Keywords|                            |accepts-invalid, openmp
      Known to fail|                            |4.2.1 4.3.0
   Last reconfirmed|0000-00-00 00:00:00         |2007-06-22 20:28:31
               date|                            |
            Summary|STRUCTURE CONTAINING        |structure containing
                   |ALLOCATABLE ARRAY 'A'       |allocatable array is
                   |APPEARS IN COPYIN CLAUSE    |accepted in COPYIN clause


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32467


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/32467] structure containing allocatable array is accepted in COPYIN clause
  2007-06-22 19:43 [Bug fortran/32467] New: STRUCTURE CONTAINING ALLOCATABLE ARRAY 'A' APPEARS IN COPYIN CLAUSE longb at cray dot com
  2007-06-22 20:28 ` [Bug fortran/32467] structure containing allocatable array is accepted in COPYIN clause dfranke at gcc dot gnu dot org
@ 2007-06-22 20:39 ` dfranke at gcc dot gnu dot org
  2007-06-22 20:43 ` dfranke at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-06-22 20:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from dfranke at gcc dot gnu dot org  2007-06-22 20:38 -------
Barf. The testcase in comment #1 is detected by gfortran-svn (20070522), the
original testcase (allocatable structure components) is not.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32467


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/32467] structure containing allocatable array is accepted in COPYIN clause
  2007-06-22 19:43 [Bug fortran/32467] New: STRUCTURE CONTAINING ALLOCATABLE ARRAY 'A' APPEARS IN COPYIN CLAUSE longb at cray dot com
  2007-06-22 20:28 ` [Bug fortran/32467] structure containing allocatable array is accepted in COPYIN clause dfranke at gcc dot gnu dot org
  2007-06-22 20:39 ` dfranke at gcc dot gnu dot org
@ 2007-06-22 20:43 ` dfranke at gcc dot gnu dot org
  2007-06-22 21:07 ` burnus at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-06-22 20:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from dfranke at gcc dot gnu dot org  2007-06-22 20:42 -------
Mine. Fix should be easy :)


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |dfranke at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-06-22 20:28:31         |2007-06-22 20:42:59
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32467


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/32467] structure containing allocatable array is accepted in COPYIN clause
  2007-06-22 19:43 [Bug fortran/32467] New: STRUCTURE CONTAINING ALLOCATABLE ARRAY 'A' APPEARS IN COPYIN CLAUSE longb at cray dot com
                   ` (2 preceding siblings ...)
  2007-06-22 20:43 ` dfranke at gcc dot gnu dot org
@ 2007-06-22 21:07 ` burnus at gcc dot gnu dot org
  2007-06-24 18:40 ` patchapp at dberlin dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-06-22 21:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from burnus at gcc dot gnu dot org  2007-06-22 21:06 -------
Thanks for the report.

(By the way, ifort does accept the program and gives the right result whereas
sunf95 has the same problem as gfortran.)

There are actually two problems:

a) "Allocatable arrays may not appear in a copyin clause."
   This is violated for  copyin(struc1)
   One should at least print a warning with -Wall, but I'm not sure
   whether one need to reject it as GCC seems to do the right thing (cf. (b))

b) If one replaces the "allocatable :: a(:)" by "a(2)" this constrain is met,
   but the number of threads is still (one thread per CPU core online) instead
   of being omp_set_num_threads(4).

Reading and re-reading 2.4.1 I fail to find the place which says that with
  omp_set_dynamic(.true.)
  omp_set_num_threads(4)
the number of threads is guaranteed to be 4. Using omp_set_dynamic(.false.) the
situation is clear and gfortran (and sunf95) produce the same result.
I have the feeling that the result of gfortran is perfectly valid.

ifort seems to default for dyn-var = true to the specified number number of
processors whereas sunf95 and gfortran seem to use min(CPU cores online,
specified num_threads).


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu dot org
                URL|                            |http://www.openmp.org/drupal
                   |                            |/mp-documents/spec25.pdf
           Keywords|accepts-invalid             |wrong-code


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32467


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/32467] structure containing allocatable array is accepted in COPYIN clause
  2007-06-22 19:43 [Bug fortran/32467] New: STRUCTURE CONTAINING ALLOCATABLE ARRAY 'A' APPEARS IN COPYIN CLAUSE longb at cray dot com
                   ` (3 preceding siblings ...)
  2007-06-22 21:07 ` burnus at gcc dot gnu dot org
@ 2007-06-24 18:40 ` patchapp at dberlin dot org
  2007-06-25 18:52 ` dfranke at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: patchapp at dberlin dot org @ 2007-06-24 18:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from patchapp at dberlin dot org  2007-06-24 18:40 -------
Subject: Bug number PR32467

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2007-06/msg01809.html


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32467


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/32467] structure containing allocatable array is accepted in COPYIN clause
  2007-06-22 19:43 [Bug fortran/32467] New: STRUCTURE CONTAINING ALLOCATABLE ARRAY 'A' APPEARS IN COPYIN CLAUSE longb at cray dot com
                   ` (4 preceding siblings ...)
  2007-06-24 18:40 ` patchapp at dberlin dot org
@ 2007-06-25 18:52 ` dfranke at gcc dot gnu dot org
  2007-06-26 18:20 ` longb at cray dot com
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-06-25 18:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from dfranke at gcc dot gnu dot org  2007-06-25 18:51 -------
Updated patch:
    http://gcc.gnu.org/ml/gcc-patches/2007-06/msg01858.html


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32467


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/32467] structure containing allocatable array is accepted in COPYIN clause
  2007-06-22 19:43 [Bug fortran/32467] New: STRUCTURE CONTAINING ALLOCATABLE ARRAY 'A' APPEARS IN COPYIN CLAUSE longb at cray dot com
                   ` (5 preceding siblings ...)
  2007-06-25 18:52 ` dfranke at gcc dot gnu dot org
@ 2007-06-26 18:20 ` longb at cray dot com
  2007-06-27 20:03 ` dfranke at gcc dot gnu dot org
  2007-06-27 20:04 ` dfranke at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: longb at cray dot com @ 2007-06-26 18:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from longb at cray dot com  2007-06-26 18:20 -------
Subject: Re:  structure containing allocatable array is
 accepted in COPYIN clause

burnus at gcc dot gnu dot org wrote:
> ------- Comment #4 from burnus at gcc dot gnu dot org  2007-06-22 21:06 -------
> Thanks for the report.
>
>   
....
> Reading and re-reading 2.4.1 I fail to find the place which says that with
>   omp_set_dynamic(.true.)
>   omp_set_num_threads(4)
> the number of threads is guaranteed to be 4. Using omp_set_dynamic(.false.) the
> situation is clear and gfortran (and sunf95) produce the same result.
> I have the feeling that the result of gfortran is perfectly valid.
>   

I agree.  If dynamic mode is off, the number of threads can be less than 
num_threads.

> ifort seems to default for dyn-var = true to the specified number number of
> processors whereas sunf95 and gfortran seem to use min(CPU cores online,
> specified num_threads).
>   

Useful information.  Thanks.

Cheers,
Bill

>
>   


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32467


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/32467] structure containing allocatable array is accepted in COPYIN clause
  2007-06-22 19:43 [Bug fortran/32467] New: STRUCTURE CONTAINING ALLOCATABLE ARRAY 'A' APPEARS IN COPYIN CLAUSE longb at cray dot com
                   ` (6 preceding siblings ...)
  2007-06-26 18:20 ` longb at cray dot com
@ 2007-06-27 20:03 ` dfranke at gcc dot gnu dot org
  2007-06-27 20:04 ` dfranke at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-06-27 20:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from dfranke at gcc dot gnu dot org  2007-06-27 20:03 -------
Subject: Bug 32467

Author: dfranke
Date: Wed Jun 27 20:02:31 2007
New Revision: 126063

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=126063
Log:
gcc/fortran:
2007-06-24  Daniel Franke  <franke.daniel@gmail.com>

        PR fortran/32467
        * openmp.c (resolve_omp_clauses): Emit error on allocatable components 
        in COPYIN, COPYPRIVATE, FIRSTPRIVATE and LASTPRIVATE clauses.

gcc/testsuite:
2007-06-24  Daniel Franke  <franke.daniel@gmail.com>

        PR fortran/32467
        * gfortran.dg/gomp/allocatable_components_1.f90: New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/gomp/allocatable_components_1.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/openmp.c
    trunk/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32467


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/32467] structure containing allocatable array is accepted in COPYIN clause
  2007-06-22 19:43 [Bug fortran/32467] New: STRUCTURE CONTAINING ALLOCATABLE ARRAY 'A' APPEARS IN COPYIN CLAUSE longb at cray dot com
                   ` (7 preceding siblings ...)
  2007-06-27 20:03 ` dfranke at gcc dot gnu dot org
@ 2007-06-27 20:04 ` dfranke at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-06-27 20:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from dfranke at gcc dot gnu dot org  2007-06-27 20:04 -------
Fixed in trunk. Not a regression, thus no backport to 4.2. Closing.


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
           Keywords|wrong-code                  |accepts-invalid
      Known to fail|4.2.1 4.3.0                 |4.2.1
      Known to work|                            |4.3.0
         Resolution|                            |FIXED
   Target Milestone|---                         |4.3.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32467


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2007-06-27 20:04 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-22 19:43 [Bug fortran/32467] New: STRUCTURE CONTAINING ALLOCATABLE ARRAY 'A' APPEARS IN COPYIN CLAUSE longb at cray dot com
2007-06-22 20:28 ` [Bug fortran/32467] structure containing allocatable array is accepted in COPYIN clause dfranke at gcc dot gnu dot org
2007-06-22 20:39 ` dfranke at gcc dot gnu dot org
2007-06-22 20:43 ` dfranke at gcc dot gnu dot org
2007-06-22 21:07 ` burnus at gcc dot gnu dot org
2007-06-24 18:40 ` patchapp at dberlin dot org
2007-06-25 18:52 ` dfranke at gcc dot gnu dot org
2007-06-26 18:20 ` longb at cray dot com
2007-06-27 20:03 ` dfranke at gcc dot gnu dot org
2007-06-27 20:04 ` dfranke 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).