https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71589

            Bug ID: 71589
           Summary: Atomic operation on a non-atomic variable
           Product: gcc
           Version: 6.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: wolfgang.roe...@gi-de.com
  Target Milestone: ---

Hi,

I would like to post a bug report for the GNU C/C++ compiler 6.1.1.

We use the compiler to generate code for a PowerPC processor.

Invokation line for the GNU C compiler:

ccppc -c -x c -std=gnu11 -Wall -Werror -g -mcpu=e6500 -m32
      -maltivec -mvrsave -ftls-model=local-exec -msdata=sysv
      -fno-common -fno-openmp -mbig -mmultiple -mno-string -misel
      -mstrict-align -fverbose-asm -G 8 -O3
      -I<some include paths>
      -D<some #define's>
      X.C -oX.O


// file X.C

#include "stdatomic.h"

int* p0;

void bug (void)
{
    atomic_fetch_add_explicit (&p0, 1, memory_order_relaxed);
}


The compiler accepts this programm even though p0 is a non-atomic pointer.

I think this is not standard conforming. The C11 standard decribes the
atomic_fetch functions as expecting a pointer to an atomic type (see
7.17.1/5 and 7.17.7.5/1).


With kind regards
W. Roehrl

Reply via email to