public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/32550]  New: THE COPYPRIVATE CLAUSE FAILS TO COPY THE PTR AT THE END OF A 'SINGLE' CONSTRUCT
@ 2007-06-29 18:46 longb at cray dot com
  2007-06-29 21:00 ` [Bug fortran/32550] openmp: COPYPRIVATE of pointer variables fails dfranke at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: longb at cray dot com @ 2007-06-29 18:46 UTC (permalink / raw)
  To: gcc-bugs

Description:

The test case checks that
the following statement found in the section 2.8.4.2 copyprivate clause
of the OpenMP API Version 2.5 May 2005 (p. 86 lines 22-24) will work:

"If the list item is a pointer, then in all other threads in the team,
the list item becomes pointer associated (as if by pointer assignment) with
the corresponding list itme in the thread that executed the structure block."
associated with the single construct.

Currently the test case fails with a "Killed" message that is probably due
to a bad address when handling the copyprivate directive after completing
the structured block of the single construct.

> 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 bug2836.f90
! Derived from OpenMP test omp1/F2_6_2_8_5ze.f90
      use omp_lib
      implicit none
      integer, parameter :: NT = 4
      integer :: nThreads(NT)
      integer, pointer,save :: ptr
      integer, target :: targ
!$omp threadprivate(ptr)

!$    call omp_set_dynamic(.false.)
!$    call omp_set_num_threads(NT)

      targ = 0
      nThreads = 0

!$omp parallel shared(targ)
!$omp single
      print *, 'begin single  PE=',omp_get_thread_num()
      ptr => targ
      targ = 1
      print *, 'end   single  PE=',omp_get_thread_num()
!$omp end single copyprivate(ptr)
      print *, 'after single  PE=',omp_get_thread_num()
!$omp barrier
      nThreads(omp_get_thread_num()+1) = ptr
!$omp end parallel

      print *, nThreads
      END

> ftn -O3 -fopenmp -o x bug2836.f90
> aprun -n 1 ./x
 begin single  PE=           0
 end   single  PE=           0
Application 4396 exit signals: Killed
Application 4396 resources: utime 0, stime 0


Expected output using the PGI compiler:

> ftn -o x -O3 -mp -Mconcur=nonuma bug2836.f90
bug2836.f90:
> aprun -n 1 ./x
Warning: omp_set_num_threads (4) greater than available cpus (1)
 begin single  PE=            1
 end   single  PE=            1
 after single  PE=            0
 after single  PE=            1
 after single  PE=            2
 after single  PE=            3
            1            1            1            1
Application 4399 resources: utime 0, stime 0

------
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: THE COPYPRIVATE CLAUSE FAILS TO COPY THE PTR AT THE END
                    OF A 'SINGLE' CONSTRUCT
           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=32550


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

* [Bug fortran/32550] openmp: COPYPRIVATE of pointer variables fails
  2007-06-29 18:46 [Bug fortran/32550] New: THE COPYPRIVATE CLAUSE FAILS TO COPY THE PTR AT THE END OF A 'SINGLE' CONSTRUCT longb at cray dot com
@ 2007-06-29 21:00 ` dfranke at gcc dot gnu dot org
  2007-07-02 11:17 ` jakub at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-06-29 21:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from dfranke at gcc dot gnu dot org  2007-06-29 21:00 -------
Bill, thanks for your report! Here's a slightly simplified testcase:

$> cat pr32550.f90
integer, pointer, save :: ptr
integer, target :: targ
!$omp threadprivate(ptr)
!$omp parallel shared(targ)
!$omp single
ptr => targ
!$omp end single copyprivate(ptr)
!$omp end parallel
END

The testcase compiles, but crashes on execution (SIGSEGV). If the
COPYPRIVATE-clause or the pointer/target attributes are removed, the resulting
binary does not crash. 

Output from gdb is not very helpful, but valgrind gives:

==32677== Thread 2:
==32677== Invalid write of size 4
==32677==    at 0x80486FE: MAIN__.omp_fn.0 (pr32550.f90:9)
==32677==    by 0x40FAFFC: gomp_thread_start (team.c:108)
==32677==    by 0x410F2C0: start_thread (in /lib/libpthread-2.5.so)
==32677==    by 0x41D8FAD: clone (in /lib/libc-2.5.so)
==32677==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==32677==
==32677== Process terminating with default action of signal 11 (SIGSEGV)
==32677==  Access not within mapped region at address 0x0
==32677==    at 0x80486FE: MAIN__.omp_fn.0 (pr32550.f90:9)
==32677==    by 0x40FAFFC: gomp_thread_start (team.c:108)
==32677==    by 0x410F2C0: start_thread (in /lib/libpthread-2.5.so)
==32677==    by 0x41D8FAD: clone (in /lib/libc-2.5.so)

Adding Jakub as CC.


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dfranke at gcc dot gnu dot
                   |                            |org, jakub 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|                            |openmp
      Known to fail|                            |4.2.1 4.3.0
   Last reconfirmed|0000-00-00 00:00:00         |2007-06-29 21:00:42
               date|                            |
            Summary|THE COPYPRIVATE CLAUSE FAILS|openmp: COPYPRIVATE of
                   |TO COPY THE PTR AT THE END  |pointer variables fails
                   |OF A 'SINGLE' CONSTRUCT     |


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


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

* [Bug fortran/32550] openmp: COPYPRIVATE of pointer variables fails
  2007-06-29 18:46 [Bug fortran/32550] New: THE COPYPRIVATE CLAUSE FAILS TO COPY THE PTR AT THE END OF A 'SINGLE' CONSTRUCT longb at cray dot com
  2007-06-29 21:00 ` [Bug fortran/32550] openmp: COPYPRIVATE of pointer variables fails dfranke at gcc dot gnu dot org
@ 2007-07-02 11:17 ` jakub at gcc dot gnu dot org
  2007-07-12 12:17 ` jakub at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-07-02 11:17 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|NEW                         |ASSIGNED
   Last reconfirmed|2007-06-29 21:00:42         |2007-07-02 11:17:02
               date|                            |


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


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

* [Bug fortran/32550] openmp: COPYPRIVATE of pointer variables fails
  2007-06-29 18:46 [Bug fortran/32550] New: THE COPYPRIVATE CLAUSE FAILS TO COPY THE PTR AT THE END OF A 'SINGLE' CONSTRUCT longb at cray dot com
  2007-06-29 21:00 ` [Bug fortran/32550] openmp: COPYPRIVATE of pointer variables fails dfranke at gcc dot gnu dot org
  2007-07-02 11:17 ` jakub at gcc dot gnu dot org
@ 2007-07-12 12:17 ` jakub at gcc dot gnu dot org
  2007-07-12 12:21 ` jakub at gcc dot gnu dot org
  2007-09-17 22:38 ` jakub at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-07-12 12:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jakub at gcc dot gnu dot org  2007-07-12 12:17 -------
Subject: Bug 32550

Author: jakub
Date: Thu Jul 12 12:16:54 2007
New Revision: 126583

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=126583
Log:
        PR fortran/32550
        * trans.h (GFC_POINTER_TYPE_P): Define.
        * trans-types.c (gfc_sym_type): Set it for types on attr->sym.pointer.
        * trans-openmp.c (gfc_omp_privatize_by_reference): Return false
        if GFC_POINTER_TYPE_P is set on the type.

        * testsuite/libgomp.fortran/pr32550.f90: New test.
        * testsuite/libgomp.fortran/crayptr2.f90: New test.

Added:
    trunk/libgomp/testsuite/libgomp.fortran/crayptr2.f90
    trunk/libgomp/testsuite/libgomp.fortran/pr32550.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-openmp.c
    trunk/gcc/fortran/trans-types.c
    trunk/gcc/fortran/trans.h
    trunk/libgomp/ChangeLog


-- 


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


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

* [Bug fortran/32550] openmp: COPYPRIVATE of pointer variables fails
  2007-06-29 18:46 [Bug fortran/32550] New: THE COPYPRIVATE CLAUSE FAILS TO COPY THE PTR AT THE END OF A 'SINGLE' CONSTRUCT longb at cray dot com
                   ` (2 preceding siblings ...)
  2007-07-12 12:17 ` jakub at gcc dot gnu dot org
@ 2007-07-12 12:21 ` jakub at gcc dot gnu dot org
  2007-09-17 22:38 ` jakub at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-07-12 12:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jakub at gcc dot gnu dot org  2007-07-12 12:20 -------
Fixed in 4.3.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|4.2.1 4.3.0                 |4.2.1
      Known to work|                            |4.3.0


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


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

* [Bug fortran/32550] openmp: COPYPRIVATE of pointer variables fails
  2007-06-29 18:46 [Bug fortran/32550] New: THE COPYPRIVATE CLAUSE FAILS TO COPY THE PTR AT THE END OF A 'SINGLE' CONSTRUCT longb at cray dot com
                   ` (3 preceding siblings ...)
  2007-07-12 12:21 ` jakub at gcc dot gnu dot org
@ 2007-09-17 22:38 ` jakub at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-09-17 22:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jakub at gcc dot gnu dot org  2007-09-17 22:37 -------
Won't fix for 4.2.


-- 

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=32550


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

end of thread, other threads:[~2007-09-17 22:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-29 18:46 [Bug fortran/32550] New: THE COPYPRIVATE CLAUSE FAILS TO COPY THE PTR AT THE END OF A 'SINGLE' CONSTRUCT longb at cray dot com
2007-06-29 21:00 ` [Bug fortran/32550] openmp: COPYPRIVATE of pointer variables fails dfranke at gcc dot gnu dot org
2007-07-02 11:17 ` jakub at gcc dot gnu dot org
2007-07-12 12:17 ` jakub at gcc dot gnu dot org
2007-07-12 12:21 ` jakub at gcc dot gnu dot org
2007-09-17 22:38 ` 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).