https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68907
Bug ID: 68907
Summary: bogus warning: right-hand operand of comma expression
has no effect on an atomic_int preincrement
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: msebor at gcc dot gnu.org
Target Milestone: ---
GCC 5.1.0 and current trunk issue the following incorrect warning on the
preincrement of an _Atomic variable.
$ cat ~/tmp/t.c && /build/gcc-trunk/gcc/xgcc -B /build/gcc-trunk/gcc -S -Wall
-Wextra -o/dev/null ~/tmp/t.c
$ cat ~/tmp/t.c && /build/gcc-trunk/gcc/xgcc -B /build/gcc-trunk/gcc -S -Wall
-Wextra -o/dev/null ~/tmp/t.c
typedef _Atomic int AI;
extern AI ai;
void increment (void)
{
++ai;
}
/home/remote/msebor/tmp/t.c: In function ‘increment’:
/home/remote/msebor/tmp/t.c:7:5: warning: right-hand operand of comma
expression has no effect [-Wunused-value]
++ai;
^~~~