public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/35130]  New: OpenMP: Private variable passed to subroutine
@ 2008-02-07 22:25 burnus at gcc dot gnu dot org
  2008-02-07 22:44 ` [Bug fortran/35130] " jakub at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-02-07 22:25 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1072 bytes --]

As reported by Ignacio Fernández Galván, the following program prints with
"gfortran -fopenmp" 0.0 instead of 42.0. Without -fopenmp or using, e.g., ifort
or sunf95 42.0 is printed.

See also http://gcc.gnu.org/ml/fortran/2008-02/msg00058.html

I believe the program is valid, compare also
http://www.openmp.org/pipermail/omp/2006/000532.html

PROGRAM Outer
 IMPLICIT NONE
 REAL, DIMENSION(20) :: A
 INTEGER :: k
 A = 0.0
!$OMP PARALLEL DO PRIVATE(k)
 DO k=1,SIZE(A)
   CALL Inner(k)
 END DO
!$OMP END PARALLEL DO
 print *, A
CONTAINS
 SUBROUTINE Inner(i)
   IMPLICIT NONE
   INTEGER :: i
   A(i) = 42
 END SUBROUTINE Inner
END PROGRAM Outer


-- 
           Summary: OpenMP: Private variable passed to subroutine
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: wrong-code, openmp
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


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


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

* [Bug fortran/35130] OpenMP: Private variable passed to subroutine
  2008-02-07 22:25 [Bug fortran/35130] New: OpenMP: Private variable passed to subroutine burnus at gcc dot gnu dot org
@ 2008-02-07 22:44 ` jakub at gcc dot gnu dot org
  2008-02-07 22:45 ` jakub at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-02-07 22:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jakub at gcc dot gnu dot org  2008-02-07 22:44 -------
*** Bug 35133 has been marked as a duplicate of this bug. ***


-- 


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


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

* [Bug fortran/35130] OpenMP: Private variable passed to subroutine
  2008-02-07 22:25 [Bug fortran/35130] New: OpenMP: Private variable passed to subroutine burnus at gcc dot gnu dot org
  2008-02-07 22:44 ` [Bug fortran/35130] " jakub at gcc dot gnu dot org
@ 2008-02-07 22:45 ` jakub at gcc dot gnu dot org
  2008-02-10 15:38 ` fxcoudert at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-02-07 22:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jakub at gcc dot gnu dot org  2008-02-07 22:44 -------
*** Bug 35131 has been marked as a duplicate of this bug. ***


-- 


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


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

* [Bug fortran/35130] OpenMP: Private variable passed to subroutine
  2008-02-07 22:25 [Bug fortran/35130] New: OpenMP: Private variable passed to subroutine burnus at gcc dot gnu dot org
  2008-02-07 22:44 ` [Bug fortran/35130] " jakub at gcc dot gnu dot org
  2008-02-07 22:45 ` jakub at gcc dot gnu dot org
@ 2008-02-10 15:38 ` fxcoudert at gcc dot gnu dot org
  2008-02-11 16:12 ` [Bug middle-end/35130] " jakub at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2008-02-10 15:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from fxcoudert at gcc dot gnu dot org  2008-02-10 15:37 -------
I have managed to reduce it a bit more, and it does not involve passing the
loop variable as an argument:

program outer
  integer k, a(1)
  a = 0.0
!$OMP PARALLEL DO
  do k = 1, 1
    call inner
  end do
!$OMP END PARALLEL DO
 print *, a(1)

contains
  subroutine inner
    a(1) = 42
  end subroutine inner
end program outer

>From the tree dump, I've made the following C testcase which also exhibits the
same bug:

$ cat u.c 
int main (void)
{
  int a[1], k;
  void inner (void) { a[0] = 42; }

  a[0] = 0;

  #pragma omp parallel
  #pragma omp for private(k) nowait
  for (k = 1; k <= 1; k = k + 1)
    inner ();

  __builtin_printf ("%d\n", a[0]);
  return 0;
}

$ gcc -fopenmp u.c && ./a.out
0


There is no OpenMP component, and since I'm not sure the C code I have created
is valid, I leave this bug as "fortran" for now... but I think it's a generic
issue of contained functions.


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fxcoudert at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-02-10 15:37:46
               date|                            |


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


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

* [Bug middle-end/35130] OpenMP: Private variable passed to subroutine
  2008-02-07 22:25 [Bug fortran/35130] New: OpenMP: Private variable passed to subroutine burnus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2008-02-10 15:38 ` fxcoudert at gcc dot gnu dot org
@ 2008-02-11 16:12 ` jakub at gcc dot gnu dot org
  2008-02-15 17:38 ` jakub at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-02-11 16:12 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
          Component|fortran                     |middle-end
   Last reconfirmed|2008-02-10 15:37:46         |2008-02-11 16:11:27
               date|                            |


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


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

* [Bug middle-end/35130] OpenMP: Private variable passed to subroutine
  2008-02-07 22:25 [Bug fortran/35130] New: OpenMP: Private variable passed to subroutine burnus at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2008-02-11 16:12 ` [Bug middle-end/35130] " jakub at gcc dot gnu dot org
@ 2008-02-15 17:38 ` jakub at gcc dot gnu dot org
  2008-02-15 17:51 ` jakub at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-02-15 17:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jakub at gcc dot gnu dot org  2008-02-15 17:37 -------
Subject: Bug 35130

Author: jakub
Date: Fri Feb 15 17:36:43 2008
New Revision: 132349

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132349
Log:
        PR middle-end/35130
        * tree-nested.c (convert_call_expr): Put FRAME.* vars into
        OMP_CLAUSE_SHARED rather than OMP_CLAUSE_FIRSTPRIVATE clause.

        * testsuite/libgomp.fortran/pr35130.f90: New test.
        * testsuite/libgomp.c/pr35130.c: New test.

Added:
    trunk/libgomp/testsuite/libgomp.c/pr35130.c
    trunk/libgomp/testsuite/libgomp.fortran/pr35130.f90
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/tree-nested.c
    trunk/libgomp/ChangeLog


-- 


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


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

* [Bug middle-end/35130] OpenMP: Private variable passed to subroutine
  2008-02-07 22:25 [Bug fortran/35130] New: OpenMP: Private variable passed to subroutine burnus at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2008-02-15 17:38 ` jakub at gcc dot gnu dot org
@ 2008-02-15 17:51 ` jakub at gcc dot gnu dot org
  2008-02-15 18:10 ` ubizjak at gmail dot com
  2008-05-28  7:18 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-02-15 17:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jakub at gcc dot gnu dot org  2008-02-15 17:50 -------
Fixed on the trunk.


-- 


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


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

* [Bug middle-end/35130] OpenMP: Private variable passed to subroutine
  2008-02-07 22:25 [Bug fortran/35130] New: OpenMP: Private variable passed to subroutine burnus at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2008-02-15 17:51 ` jakub at gcc dot gnu dot org
@ 2008-02-15 18:10 ` ubizjak at gmail dot com
  2008-05-28  7:18 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: ubizjak at gmail dot com @ 2008-02-15 18:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from ubizjak at gmail dot com  2008-02-15 18:10 -------
Fixed for real.


-- 

ubizjak at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.3.0


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


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

* [Bug middle-end/35130] OpenMP: Private variable passed to subroutine
  2008-02-07 22:25 [Bug fortran/35130] New: OpenMP: Private variable passed to subroutine burnus at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2008-02-15 18:10 ` ubizjak at gmail dot com
@ 2008-05-28  7:18 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-05-28  7:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pinskia at gcc dot gnu dot org  2008-05-28 07:18 -------
*** Bug 36351 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hailijuan at gmail dot com


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


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

end of thread, other threads:[~2008-05-28  7:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-07 22:25 [Bug fortran/35130] New: OpenMP: Private variable passed to subroutine burnus at gcc dot gnu dot org
2008-02-07 22:44 ` [Bug fortran/35130] " jakub at gcc dot gnu dot org
2008-02-07 22:45 ` jakub at gcc dot gnu dot org
2008-02-10 15:38 ` fxcoudert at gcc dot gnu dot org
2008-02-11 16:12 ` [Bug middle-end/35130] " jakub at gcc dot gnu dot org
2008-02-15 17:38 ` jakub at gcc dot gnu dot org
2008-02-15 17:51 ` jakub at gcc dot gnu dot org
2008-02-15 18:10 ` ubizjak at gmail dot com
2008-05-28  7:18 ` pinskia 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).