https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69769
Bug ID: 69769 Summary: arithmetic operation on pointer to a function Product: gcc Version: 6.0 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.0.0. We use the compiler to generate code for a PowerPC processor. Invokation line for the GNU C++ compiler: ccppc -c -x c++ -std=gnu++14 -Wall -Werror -g -mcpu=e6500 -m32 -maltivec=be -mvrsave -ftls-model=local-exec -msdata=sysv -fno-common -fno-openmp -mbig -mmultiple -mno-string -misel -mstrict-align -fverbose-asm -fno-exceptions -fno-rtti -ftemplate-backtrace-limit=20 -G 8 -O3 -I<some include paths> -D<some #define's> X.CPP -oX.O // file X.CPP #include "atomic" typedef void (T_FUNC) (int); T_FUNC* getFunc (std::atomic<T_FUNC*>& refPtr) { return refPtr.fetch_add(0, std::memory_order_relaxed); } The compiler accepts this programm despite of performing an arithmetic operation on pointer to a function. I think this is not standard conforming. The C++11 standard, 29.6.5/28 describes the semantic of the atomic fetch functions: "Atomically replaces the value pointed to [...] by this with the result of the computation applied to the value pointed to [...] by this and the given operand." But applying an arithmetic operation on pointer to a function is not a legal computation. With kind regards W. Roehrl