[Bug middle-end/25261] [gomp] Nested function calls in #pragma omp parallel blocks

2007-01-10 Thread pinskia at gcc dot gnu dot org


-- 

pinskia at gcc dot gnu dot org changed:

   What|Removed |Added

   Target Milestone|--- |4.2.0


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



[Bug middle-end/25261] [gomp] Nested function calls in #pragma omp parallel blocks

2006-09-26 Thread jakub at gcc dot gnu dot org


--- Comment #5 from jakub at gcc dot gnu dot org  2006-09-26 18:11 ---
Subject: Bug 25261

Author: jakub
Date: Tue Sep 26 18:10:58 2006
New Revision: 117235

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=117235
Log:
PR middle-end/25261
PR middle-end/28790
* tree-nested.c (struct nesting_info): Added static_chain_added.
(convert_call_expr): Set static_chain_added when adding static
chain.  Handle OMP_PARALLEL and OMP_SECTION.

* gcc.dg/gomp/nestedfn-1.c: New test.

* testsuite/libgomp.c/nestedfn-4.c: New test.
* testsuite/libgomp.c/nestedfn-5.c: New test.
* testsuite/libgomp.fortran/nestedfn3.f90: New test.

Added:
trunk/gcc/testsuite/gcc.dg/gomp/nestedfn-1.c
trunk/libgomp/testsuite/libgomp.c/nestedfn-4.c
trunk/libgomp/testsuite/libgomp.c/nestedfn-5.c
trunk/libgomp/testsuite/libgomp.fortran/nestedfn3.f90
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-nested.c
trunk/libgomp/ChangeLog


-- 


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



[Bug middle-end/25261] [gomp] Nested function calls in #pragma omp parallel blocks

2006-09-26 Thread pinskia at gcc dot gnu dot org


--- Comment #6 from pinskia at gcc dot gnu dot org  2006-09-27 02:51 ---
Fixed.


-- 

pinskia at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED


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



[Bug middle-end/25261] [gomp] Nested function calls in #pragma omp parallel blocks

2006-09-22 Thread jakub at gcc dot gnu dot org


-- 

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 |
URL||http://gcc.gnu.org/ml/gcc-
   ||patches/2006-
   ||09/msg00988.html
 Status|NEW |ASSIGNED
   Keywords||patch
   Last reconfirmed|2006-08-21 12:35:42 |2006-09-22 16:35:21
   date||


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



[Bug middle-end/25261] [gomp] Nested function calls in #pragma omp parallel blocks

2006-09-11 Thread jakub at gcc dot gnu dot org


--- Comment #3 from jakub at gcc dot gnu dot org  2006-09-11 14:22 ---
I believe OMP_PARALLEL handling in tree-nested.c isn't the only problem, see
e.g.:
extern void abort (void);

void
foo (int *j)
{
  int i = 5;
  int bar (void) { return i + 1; }
#pragma omp sections private (i)
  {
#pragma omp section
{
  i = 6;
  if (bar () != 7)
#pragma omp atomic
  ++*j;
}
#pragma omp section
{
  if (bar () != 6)
#pragma omp atomic
  ++*j;
}
  }
}

int
main (void)
{
  int j = 0;
#pragma omp parallel num_threads (2)
  foo (j);
  if (j)
abort ();
  return 0;
}

My understanding is that even the OMP_PRIVATE clause in the worksharing
construct
should result in a different FRAME.  Another testcase:
extern void abort (void);
extern int omp_get_thread_num ();
extern void omp_set_dynamic (int);

int
main (void)
{
  int j = 0, k = 6, l = 7, m = 8;
  void
  foo (void)
  {
int i = 5;
int bar (void) { return i + 1 + (j  100 ? 1 : 0); }
  #pragma omp sections private (i)
{
  #pragma omp section
  {
i = 6;
if (bar () != 7)
  #pragma omp atomic
++j;
  }
  #pragma omp section
  {
if (bar () != 6)
  #pragma omp atomic
++j;
  }
}
if (k != 6 + omp_get_thread_num () || l != 7 || m != 9)
  #pragma omp atomic
++j;
  }
  omp_set_dynamic (0);
#pragma omp parallel num_threads (2) firstprivate (k) shared (l) private (m)
  {
if (omp_get_thread_num () != 0)
  k += omp_get_thread_num ();
m = 9;
foo ();
  }
  if (j)
abort ();
  return 0;
}

I believe in many cases we will have to force use_pointer_in_frame when OpenMP
constructs are involved in the parent routines of nested functions.  We don't
need it if either all the variables in FRAME structure are shared (then we can
pass around a pointer to the parent's FRAME), or if all are private (then we
could create a completely new copy of the FRAME and make the private vars live
in there), but as soon as things start to get mixed, we need to use pointers.
But not sure how easy would be to figure it out.  As convert_nonlocal_reference
already needs to know if it should use pointer or a var directly, we'd need
another flag_openmp pass before walk_all_functions (convert_nonlocal_reference,
root); that would perhaps stick all vars mentioned in omp clauses in some hash
table in struct nesting_info and then use that as a guide to
use_pointer_in_frame.


-- 

jakub at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||rth at gcc dot gnu dot org,
   ||dnovillo at gcc dot gnu dot
   ||org


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



[Bug middle-end/25261] [gomp] Nested function calls in #pragma omp parallel blocks

2006-09-11 Thread jakub at gcc dot gnu dot org


--- Comment #4 from jakub at gcc dot gnu dot org  2006-09-11 15:46 ---
Furthermore, I have no idea what would:
extern void abort (void);

int
baz (int (*bar) (void))
{
  return bar ();
}

void
foo (int *j)
{
  int i = 5;
  int (*fn) (void);
  int bar (void) { return i + 1; }
  fn = bar;
  if (bar (fn) != 6)
#pragma omp atomic
  ++j;
#pragma omp sections private (i)
  {
#pragma omp section
{
  i = 6;
  if (baz (fn) != 7)
#pragma omp atomic
  ++*j;
}
#pragma omp section
{
  if (baz (fn) != 6)
#pragma omp atomic
  ++*j;
}
  }
}

int
main (void)
{
  int j = 0;
#pragma omp parallel num_threads (2)
  foo (j);
  if (j)
abort ();
  return 0;
}
be supposed to do.  Do other openmp compilers support nested C functions?  If
so,
what they are doing here?  It would be easy to say that e.g. all non-local vars
in nested functions are implicitly shared (i.e. we always reference the
original
parent function's variables, not any remapped ones).  But can we do the same in
Fortran where nested functions are part of the standard?


-- 


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



[Bug middle-end/25261] [gomp] Nested function calls in #pragma omp parallel blocks

2006-08-21 Thread jakub at gcc dot gnu dot org


--- Comment #2 from jakub at gcc dot gnu dot org  2006-08-21 12:35 ---
It is not that hard to try the testcase.  It is still broken.


-- 

jakub at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever Confirmed|0   |1
   Last reconfirmed|-00-00 00:00:00 |2006-08-21 12:35:42
   date||


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



[Bug middle-end/25261] [gomp] Nested function calls in #pragma omp parallel blocks

2006-01-29 Thread pinskia at gcc dot gnu dot org


--- Comment #1 from pinskia at gcc dot gnu dot org  2006-01-29 20:19 ---
Is this true any more or is it still broken.


-- 


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