public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/50675] New: master and single OpenMP constructs broken
@ 2011-10-09 12:24 markflorisson88 at gmail dot com
  2011-10-09 13:42 ` [Bug c/50675] " jakub at gcc dot gnu.org
  2011-10-09 13:46 ` markflorisson88 at gmail dot com
  0 siblings, 2 replies; 3+ messages in thread
From: markflorisson88 at gmail dot com @ 2011-10-09 12:24 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 50675
           Summary: master and single OpenMP constructs broken
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: markflorisson88@gmail.com


single and master do not work properly in loops. They are either not executed
as often as they should, or the program deadlocks entirely:

#include <stdio.h>

int main(int argc, char **argv) {
    int i;
    #pragma omp parallel
    {
        for (i = 0; i < 10; i++) {
            #pragma omp single
            puts("hello");
        }
    }
    return 0;
}

This program deadlocks in gcc 4.4 and 4.6, whereas in 4.2 is is only executed 4
times (which is the number of cores on my machine). The same goes for the
master construct.


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

* [Bug c/50675] master and single OpenMP constructs broken
  2011-10-09 12:24 [Bug c/50675] New: master and single OpenMP constructs broken markflorisson88 at gmail dot com
@ 2011-10-09 13:42 ` jakub at gcc dot gnu.org
  2011-10-09 13:46 ` markflorisson88 at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-10-09 13:42 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-10-09 13:41:54 UTC ---
User error.  The i variable is shared in your testcase, thus different threads
may encounter #pragma omp single different number of times, which is invalid.
Just use #pragma omp parallel private (i) or declare i inside of the #pragma
omp parallel block instead.


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

* [Bug c/50675] master and single OpenMP constructs broken
  2011-10-09 12:24 [Bug c/50675] New: master and single OpenMP constructs broken markflorisson88 at gmail dot com
  2011-10-09 13:42 ` [Bug c/50675] " jakub at gcc dot gnu.org
@ 2011-10-09 13:46 ` markflorisson88 at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: markflorisson88 at gmail dot com @ 2011-10-09 13:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from markflorisson88 <markflorisson88 at gmail dot com> 2011-10-09 13:46:27 UTC ---
Indeed, you are right. My apologies, I should teach myself to use
default(none).


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

end of thread, other threads:[~2011-10-09 13:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-09 12:24 [Bug c/50675] New: master and single OpenMP constructs broken markflorisson88 at gmail dot com
2011-10-09 13:42 ` [Bug c/50675] " jakub at gcc dot gnu.org
2011-10-09 13:46 ` markflorisson88 at gmail dot com

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