public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/45423]  New: #pragma omp atomic on bool has issues
@ 2010-08-26 19:17 jakub at gcc dot gnu dot org
  2010-08-26 19:17 ` [Bug middle-end/45423] " jakub at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-08-26 19:17 UTC (permalink / raw)
  To: gcc-bugs

bool b;
int i;
int
foo (void)
{
  #pragma omp atomic
    b ^= 1;
  #pragma omp barrier
  #pragma omp atomic
    b |= 1;
  #pragma omp barrier
  #pragma omp atomic
    b &= 1;
  #pragma omp barrier
  #pragma omp atomic
    b -= 1;
  #pragma omp barrier
  #pragma omp atomic
    i ^= 1;
  #pragma omp barrier
  #pragma omp atomic
    i |= 1;
  #pragma omp barrier
  #pragma omp atomic
    i &= 1;
  #pragma omp barrier
  #pragma omp atomic
    i -= 1;
  #pragma omp barrier
  #pragma omp atomic
    i &= -1;
  #pragma omp barrier
  #pragma omp atomic
    i |= -1;
  #pragma omp barrier
  return 0;
}

shows that b ^= 1 and b -= 1 isn't gimplified correctly - an expression reading
the variable before atomic_load is used in atomic_store instead of something
reading from the var in the atomic region.


-- 
           Summary: #pragma omp atomic on bool has issues
           Product: gcc
           Version: 4.6.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=45423


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

* [Bug middle-end/45423] #pragma omp atomic on bool has issues
  2010-08-26 19:17 [Bug middle-end/45423] New: #pragma omp atomic on bool has issues jakub at gcc dot gnu dot org
@ 2010-08-26 19:17 ` jakub at gcc dot gnu dot org
  2010-08-30 11:38 ` jakub at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-08-26 19:17 UTC (permalink / raw)
  To: gcc-bugs



-- 

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                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-08-26 19:17:35
               date|                            |


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


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

* [Bug middle-end/45423] #pragma omp atomic on bool has issues
  2010-08-26 19:17 [Bug middle-end/45423] New: #pragma omp atomic on bool has issues jakub at gcc dot gnu dot org
  2010-08-26 19:17 ` [Bug middle-end/45423] " jakub at gcc dot gnu dot org
@ 2010-08-30 11:38 ` jakub at gcc dot gnu dot org
  2010-08-30 17:17 ` jakub at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-08-30 11:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jakub at gcc dot gnu dot org  2010-08-30 11:38 -------
Created an attachment (id=21591)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21591&action=view)
gcc46-pr45423.patch

Patch I'm going to bootstrap/regtest.


-- 


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


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

* [Bug middle-end/45423] #pragma omp atomic on bool has issues
  2010-08-26 19:17 [Bug middle-end/45423] New: #pragma omp atomic on bool has issues jakub at gcc dot gnu dot org
  2010-08-26 19:17 ` [Bug middle-end/45423] " jakub at gcc dot gnu dot org
  2010-08-30 11:38 ` jakub at gcc dot gnu dot org
@ 2010-08-30 17:17 ` jakub at gcc dot gnu dot org
  2010-08-30 19:33 ` jakub at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-08-30 17:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jakub at gcc dot gnu dot org  2010-08-30 17:16 -------
Subject: Bug 45423

Author: jakub
Date: Mon Aug 30 17:16:29 2010
New Revision: 163653

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=163653
Log:
        PR middle-end/45423
        * gimplify.c (goa_stabilize_expr): Handle TRUTH_NOT_EXPR
        and TRUTH_{AND,OR,XOR}_EXPR.
        * c-parser.c (c_parser_omp_atomic): Handle boolean
        {PRE,POST}_{INC,DEC}REMENT.
cp/
        * parser.c (cp_parser_omp_atomic): Handle boolean
        {PRE,POST}_INCREMENT.
testsuite/
        * gcc.dg/gomp/atomic-12.c: New test.
        * gcc.dg/gomp/atomic-13.c: New test.
        * gcc.dg/gomp/atomic-14.c: New test.
        * g++.dg/gomp/atomic-11.C: New test.
        * g++.dg/gomp/atomic-12.C: New test.
        * g++.dg/gomp/atomic-13.C: New test.
        * g++.dg/gomp/atomic-14.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/gomp/atomic-11.C
    trunk/gcc/testsuite/g++.dg/gomp/atomic-12.C
    trunk/gcc/testsuite/g++.dg/gomp/atomic-13.C
    trunk/gcc/testsuite/g++.dg/gomp/atomic-14.C
    trunk/gcc/testsuite/gcc.dg/gomp/atomic-12.c
    trunk/gcc/testsuite/gcc.dg/gomp/atomic-13.c
    trunk/gcc/testsuite/gcc.dg/gomp/atomic-14.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-parser.c
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c
    trunk/gcc/gimplify.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug middle-end/45423] #pragma omp atomic on bool has issues
  2010-08-26 19:17 [Bug middle-end/45423] New: #pragma omp atomic on bool has issues jakub at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2010-08-30 17:17 ` jakub at gcc dot gnu dot org
@ 2010-08-30 19:33 ` jakub at gcc dot gnu dot org
  2010-09-02  8:01 ` jakub at gcc dot gnu dot org
  2010-09-02  8:02 ` jakub at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-08-30 19:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jakub at gcc dot gnu dot org  2010-08-30 19:33 -------
Subject: Bug 45423

Author: jakub
Date: Mon Aug 30 19:33:31 2010
New Revision: 163658

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=163658
Log:
        PR middle-end/45423
        * gimplify.c (goa_stabilize_expr): Handle TRUTH_NOT_EXPR
        and TRUTH_{AND,OR,XOR}_EXPR.
        * c-parser.c (c_parser_omp_atomic): Handle boolean
        {PRE,POST}_{INC,DEC}REMENT.
cp/
        * parser.c (cp_parser_omp_atomic): Handle boolean
        {PRE,POST}_INCREMENT.
testsuite/
        * gcc.dg/gomp/atomic-12.c: New test.
        * gcc.dg/gomp/atomic-13.c: New test.
        * gcc.dg/gomp/atomic-14.c: New test.
        * g++.dg/gomp/atomic-11.C: New test.
        * g++.dg/gomp/atomic-12.C: New test.
        * g++.dg/gomp/atomic-13.C: New test.
        * g++.dg/gomp/atomic-14.C: New test.

Added:
    branches/gcc-4_5-branch/gcc/testsuite/g++.dg/gomp/atomic-11.C
    branches/gcc-4_5-branch/gcc/testsuite/g++.dg/gomp/atomic-12.C
    branches/gcc-4_5-branch/gcc/testsuite/g++.dg/gomp/atomic-13.C
    branches/gcc-4_5-branch/gcc/testsuite/g++.dg/gomp/atomic-14.C
    branches/gcc-4_5-branch/gcc/testsuite/gcc.dg/gomp/atomic-12.c
    branches/gcc-4_5-branch/gcc/testsuite/gcc.dg/gomp/atomic-13.c
    branches/gcc-4_5-branch/gcc/testsuite/gcc.dg/gomp/atomic-14.c
Modified:
    branches/gcc-4_5-branch/gcc/ChangeLog
    branches/gcc-4_5-branch/gcc/c-parser.c
    branches/gcc-4_5-branch/gcc/cp/ChangeLog
    branches/gcc-4_5-branch/gcc/cp/parser.c
    branches/gcc-4_5-branch/gcc/gimplify.c
    branches/gcc-4_5-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug middle-end/45423] #pragma omp atomic on bool has issues
  2010-08-26 19:17 [Bug middle-end/45423] New: #pragma omp atomic on bool has issues jakub at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2010-08-30 19:33 ` jakub at gcc dot gnu dot org
@ 2010-09-02  8:01 ` jakub at gcc dot gnu dot org
  2010-09-02  8:02 ` jakub at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-09-02  8:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jakub at gcc dot gnu dot org  2010-09-02 08:01 -------
Subject: Bug 45423

Author: jakub
Date: Thu Sep  2 08:00:55 2010
New Revision: 163762

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=163762
Log:
        Backport from mainline
        2010-08-30  Jakub Jelinek  <jakub@redhat.com>

        PR middle-end/45423
        * gimplify.c (goa_stabilize_expr): Handle TRUTH_NOT_EXPR
        and TRUTH_{AND,OR,XOR}_EXPR.
        * c-parser.c (c_parser_omp_atomic): Handle boolean
        {PRE,POST}_{INC,DEC}REMENT.
cp/
        * parser.c (cp_parser_omp_atomic): Handle boolean
        {PRE,POST}_INCREMENT.
testsuite/
        * gcc.dg/gomp/atomic-12.c: New test.
        * gcc.dg/gomp/atomic-13.c: New test.
        * gcc.dg/gomp/atomic-14.c: New test.
        * g++.dg/gomp/atomic-11.C: New test.
        * g++.dg/gomp/atomic-12.C: New test.
        * g++.dg/gomp/atomic-13.C: New test.
        * g++.dg/gomp/atomic-14.C: New test.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/gomp/atomic-11.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/gomp/atomic-12.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/gomp/atomic-13.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/gomp/atomic-14.C
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/gomp/atomic-12.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/gomp/atomic-13.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/gomp/atomic-14.c
Modified:
    branches/gcc-4_4-branch/gcc/ChangeLog
    branches/gcc-4_4-branch/gcc/c-parser.c
    branches/gcc-4_4-branch/gcc/cp/ChangeLog
    branches/gcc-4_4-branch/gcc/cp/parser.c
    branches/gcc-4_4-branch/gcc/gimplify.c
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug middle-end/45423] #pragma omp atomic on bool has issues
  2010-08-26 19:17 [Bug middle-end/45423] New: #pragma omp atomic on bool has issues jakub at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2010-09-02  8:01 ` jakub at gcc dot gnu dot org
@ 2010-09-02  8:02 ` jakub at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-09-02  8:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jakub at gcc dot gnu dot org  2010-09-02 08:02 -------
Fixed for GCC 4.4+.


-- 

jakub at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2010-09-02  8:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-26 19:17 [Bug middle-end/45423] New: #pragma omp atomic on bool has issues jakub at gcc dot gnu dot org
2010-08-26 19:17 ` [Bug middle-end/45423] " jakub at gcc dot gnu dot org
2010-08-30 11:38 ` jakub at gcc dot gnu dot org
2010-08-30 17:17 ` jakub at gcc dot gnu dot org
2010-08-30 19:33 ` jakub at gcc dot gnu dot org
2010-09-02  8:01 ` jakub at gcc dot gnu dot org
2010-09-02  8:02 ` jakub 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).