[Bug c/70619] Wrong warning with VLA, comma and sizeof

2019-08-04 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70619

Eric Gallager  changed:

   What|Removed |Added

   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=91314

--- Comment #3 from Eric Gallager  ---
bug 91314 might be related to and/or a dup of this

[Bug c/70619] Wrong warning with VLA, comma and sizeof

2018-07-30 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70619

Eric Gallager  changed:

   What|Removed |Added

 CC||dmalcolm at gcc dot gnu.org,
   ||dodji at gcc dot gnu.org

--- Comment #2 from Eric Gallager  ---
cc-ing diagnostics maintainers

[Bug c/70619] Wrong warning with VLA, comma and sizeof

2017-07-29 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70619

Eric Gallager  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  ---
(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.