public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/48716] New: gcc OpenMP static variable declared in scope inside construct is predetermined shared
@ 2011-04-21 19:49 geir at cray dot com
  2011-04-22 14:11 ` [Bug c/48716] " jakub at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: geir at cray dot com @ 2011-04-21 19:49 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: gcc OpenMP static variable declared in scope inside
                    construct is predetermined shared
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: geir@cray.com


A static variable is declared inside a task construct having a
default(none) clause.  The OpenMP API says that this variable is
predetermined shared.  Currently the GNU gcc compiler wants this
variable to appear in a SHARED clause.

The OpenMP API version 3.0 (May 2008) on p. 78 lines 10 & 20 states:

"The following variables have predetermined data-sharing attributes:
 . . .
 * Static variables which are declared in a scope inside the construct
   are shared."

On p. 87 lines 22-25 the following appears:

"The default(none) clause requires that each variable that is referenced
in the construct, and that does not have a predetermined data-sharing 
attribute, must have its data-sharing attribute explicitly determined by 
being listed in a data-sharing attribute clause."

In Section 2.7 task Construct on p. 59, line 17, we see that the
default(none) clause may appear on the #pragma omp task construct.


Test case:

$ cat ISU3305.c
//  derived from OpenMP test omp3c/c03_2_9_3_1_3k.c
//  REFERENCES : OpenMP 3.0, p. 59, line 17
//               OpenMP 3.0, p. 78, line 20
//               OpenMP 3.0, p. 87, lines 22-25
int main(void) {
    #pragma omp task default(none)
    {
        static int shared_var;
        shared_var = 1;
    }
    return 0;
}
$ gcc --version
gcc (GCC) 4.6.0 20110325 (Cray Inc.)
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ gcc -c -fopenmp ISU3305.c
ISU3305.c: In function 'main':
ISU3305.c:9:20: error: 'shared_var' not specified in enclosing parallel
ISU3305.c:6:13: error: enclosing task
$

Expected results from Intel and PGI compilers:

$ pgcc -c -mp ISU3305.c
$ icc -c -openmp ISU3305.c
$


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

* [Bug c/48716] gcc OpenMP static variable declared in scope inside construct is predetermined shared
  2011-04-21 19:49 [Bug c/48716] New: gcc OpenMP static variable declared in scope inside construct is predetermined shared geir at cray dot com
@ 2011-04-22 14:11 ` jakub at gcc dot gnu.org
  2011-04-22 14:12 ` jakub at gcc dot gnu.org
  2011-06-01 11:10 ` jakub at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-04-22 14:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-04-22 14:10:48 UTC ---
Author: jakub
Date: Fri Apr 22 14:10:45 2011
New Revision: 172859

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=172859
Log:
    PR c/48716
    * gimplify.c (gimplify_bind_expr): Mark as GOVD_LOCAL also
    TREE_STATIC variables declared inside of some OpenMP construct.

    * gcc.dg/gomp/pr48716.c: New test.
    * g++.dg/gomp/pr48716.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/gomp/pr48716.C
    trunk/gcc/testsuite/gcc.dg/gomp/pr48716.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/gimplify.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c/48716] gcc OpenMP static variable declared in scope inside construct is predetermined shared
  2011-04-21 19:49 [Bug c/48716] New: gcc OpenMP static variable declared in scope inside construct is predetermined shared geir at cray dot com
  2011-04-22 14:11 ` [Bug c/48716] " jakub at gcc dot gnu.org
@ 2011-04-22 14:12 ` jakub at gcc dot gnu.org
  2011-06-01 11:10 ` jakub at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-04-22 14:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-04-22 14:11:46 UTC ---
Author: jakub
Date: Fri Apr 22 14:11:44 2011
New Revision: 172860

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=172860
Log:
    PR c/48716
    * gimplify.c (gimplify_bind_expr): Mark as GOVD_LOCAL also
    TREE_STATIC variables declared inside of some OpenMP construct.

    * gcc.dg/gomp/pr48716.c: New test.
    * g++.dg/gomp/pr48716.C: New test.

Added:
    branches/gcc-4_6-branch/gcc/testsuite/g++.dg/gomp/pr48716.C
    branches/gcc-4_6-branch/gcc/testsuite/gcc.dg/gomp/pr48716.c
Modified:
    branches/gcc-4_6-branch/gcc/ChangeLog
    branches/gcc-4_6-branch/gcc/gimplify.c
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog


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

* [Bug c/48716] gcc OpenMP static variable declared in scope inside construct is predetermined shared
  2011-04-21 19:49 [Bug c/48716] New: gcc OpenMP static variable declared in scope inside construct is predetermined shared geir at cray dot com
  2011-04-22 14:11 ` [Bug c/48716] " jakub at gcc dot gnu.org
  2011-04-22 14:12 ` jakub at gcc dot gnu.org
@ 2011-06-01 11:10 ` jakub at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-06-01 11:10 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-06-01 11:09:19 UTC ---
Fixed.


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

end of thread, other threads:[~2011-06-01 11:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-21 19:49 [Bug c/48716] New: gcc OpenMP static variable declared in scope inside construct is predetermined shared geir at cray dot com
2011-04-22 14:11 ` [Bug c/48716] " jakub at gcc dot gnu.org
2011-04-22 14:12 ` jakub at gcc dot gnu.org
2011-06-01 11:10 ` jakub at gcc dot gnu.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).