[Bug c/98029] [11 Regression] volatile triggers incorrect "warning: right-hand operand of comma expression has no effect [-Wunused-value]" since r11-5188-g32934a4f45a72144

uecker at eecs dot berkeley.edu gcc-bugzilla@gcc.gnu.org
Sat Nov 28 22:26:46 GMT 2020


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

Martin Uecker <uecker at eecs dot berkeley.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |uecker at eecs dot berkeley.edu

--- Comment #2 from Martin Uecker <uecker at eecs dot berkeley.edu> ---

It seems with the changes to lvalue conversion the code

volatile int x;
int i;
(x = 1, i = 2);

gets rewritten to

((x = 1, 1), i = 2)

and then build_compound_expr introduces the spurious warning.


There is a another possible related issue:

volatile int x;
(x, 0);

warns about

warning: variable ‘x’ set but not used


More information about the Gcc-bugs mailing list