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

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-07-30
                 CC|                            |egallager at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Alexander Cherepanov from comment #0)
> Compiling the program:
> 
> int main()
> {
>   int a[1][(0, 1)];
>   int i = 0;
>   sizeof a[i++];
> }
> 
> gives such warnings:
> 
> $ gcc -Wall example.c
> example.c: In function ‘main’:
> example.c:3:14: warning: left-hand operand of comma expression has no effect
> [-Wunused-value]
>    int a[1][(0, 1)];
>               ^
> example.c:5:10: warning: right-hand operand of comma expression has no
> effect [-Wunused-value]
>    sizeof a[i++];
>    ~~~~~~~^~~~~~
> 
> The first one is fine but the second one is wrong and confusing.

Confirmed that the wording is confusing since there's no comma expression being
pointed to. The result of the sizeof is actually unused though, so ideally the
warning would just get reworded.

Reply via email to