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

--- Comment #2 from Arsen Zahray <menkaur at gmail dot com> ---
> Why do you think it's a bug? The code is valid.
The bug I made with a code like this was that I first declared a static
const variable and used it in the program, later on I added local variables
on which the variable would depend, and I forgot to remove the static
modifier, which caused the variable to always have the same value. Static
variable is supposed to be initialized before local variables on the first
call to the function, and to me it seems that using local variables to
initialize it does not make any logical sense and is bug prone

On Fri, Jul 22, 2022 at 2:39 PM redi at gcc dot gnu.org <
gcc-bugzi...@gcc.gnu.org> wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106412
>
> Jonathan Wakely <redi at gcc dot gnu.org> changed:
>
>            What    |Removed                     |Added
>
> ----------------------------------------------------------------------------
>    Last reconfirmed|                            |2022-07-22
>              Status|UNCONFIRMED                 |WAITING
>      Ever confirmed|0                           |1
>
> --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
> (In reply to Arsen Zahray from comment #0)
> > Following code will compile without errors or warnings:
>
> Not true, there's a -Wunused-variable warning.
>
> > The bug was found in gcc 12.1.0 on arch linux
>
> Why do you think it's a bug? The code is valid.
>
> --
> You are receiving this mail because:
> You reported the bug.

Reply via email to