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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Connor Clark from comment #0)
> In the above example, I'd expect gcc to know that the values are never
> re-assigned

That is an incorrect expectation.  list is a global variable, so it could be
changed
from any other translation unit, e.g. from __attribute__((constructor)) code or
C++ constructor of a namespace variable.

Though yes, making it const or as in PR106559 a static array allows the
compiler to see it isn't changed and it does warn anyway.

Reply via email to