This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/52291] New: __sync_fetch_and_add and friends poorly specified for pointer types


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

             Bug #: 52291
           Summary: __sync_fetch_and_add and friends poorly specified for
                    pointer types
    Classification: Unclassified
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: hstong@ca.ibm.com
                CC: michaelw@ca.ibm.com
              Host: powerpc64-unknown-linux-gnu
            Target: powerpc64-unknown-linux-gnu


The documentation states, regarding the __sync_fetch_and_X builtins:
These builtins perform the operation suggested by the name, and returns the
value that had previously been in memory. That is,

          { tmp = *ptr; *ptr op= value; return tmp; }
          { tmp = *ptr; *ptr = ~(tmp & value); return tmp; }   // nand

For pointer types (which GCC accepts for these builtins) the "operation
suggested by the name" leans toward pointer arithmetic; however, the pointer
types are not suitable for these operations in C/C++.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]