public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/25261]  New: [gomp] Nested function calls in #pragma omp parallel blocks
@ 2005-12-05 10:57 jakub at gcc dot gnu dot org
  2006-01-29 20:19 ` [Bug middle-end/25261] " pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2005-12-05 10:57 UTC (permalink / raw)
  To: gcc-bugs

As mentioned in my http://gcc.gnu.org/ml/gcc-patches/2005-12/msg00035.html
mail, nested function calls in #pragma omp parallel blocks are still broken
(for all of C/C++/Fortran and at least in Fortran they are part of the
standards) and I'm even not sure what the exact semantics should be for them
if e.g. some of the variables the nested fns refer to are privatized in the
parallel and some are not.
Below is just a short testcase, we'll need several more testcases to cover
this when it is actually fixed.

/* { dg-do run } */

#include <omp.h>

extern void abort (void);

int
main (void)
{
  int i = 5, j, l = 0;
  int foo (void) { return i == 6; }
  int bar (void) { return i - 3; }

  omp_set_dynamic (0);

#pragma omp parallel for schedule (static, bar ()) num_threads (2) \
                     reduction (|:l)
  for (j = 0; j < 4; j++)
    if (omp_get_thread_num () != (j < 2))
      l = 1;

  i++;

#pragma omp parallel for schedule (static, bar ()) num_threads (2) \
                     reduction (|:l)
  for (j = 0; j < 6; j++)
    if (omp_get_thread_num () != (j < 3))
      l = 1;

#pragma omp parallel num_threads (4) reduction (|:l)
  if (! foo () || bar () != 3)
    l = 1;

  i++;

#pragma omp parallel num_threads (4) reduction (|:l)
  if (foo () || bar () != 4)
    l = 1;

  if (l)
    abort ();

  return 0;
}


-- 
           Summary: [gomp] Nested function calls in #pragma omp parallel
                    blocks
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Keywords: openmp
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org


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


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

end of thread, other threads:[~2007-01-10 19:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-05 10:57 [Bug middle-end/25261] New: [gomp] Nested function calls in #pragma omp parallel blocks jakub at gcc dot gnu dot org
2006-01-29 20:19 ` [Bug middle-end/25261] " pinskia at gcc dot gnu dot org
2006-08-21 12:35 ` jakub at gcc dot gnu dot org
2006-09-11 14:23 ` jakub at gcc dot gnu dot org
2006-09-11 15:47 ` jakub at gcc dot gnu dot org
2006-09-22 16:35 ` jakub at gcc dot gnu dot org
2006-09-26 18:11 ` jakub at gcc dot gnu dot org
2006-09-27  2:52 ` pinskia at gcc dot gnu dot org
2007-01-10 19:23 ` 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).