public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/25261] [gomp] Nested function calls in #pragma omp parallel blocks
Date: Mon, 11 Sep 2006 15:47:00 -0000	[thread overview]
Message-ID: <20060911154656.10592.qmail@sourceware.org> (raw)
In-Reply-To: <bug-25261-87@http.gcc.gnu.org/bugzilla/>



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


  parent reply	other threads:[~2006-09-11 15:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-05 10:57 [Bug middle-end/25261] New: " 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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060911154656.10592.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).