[Bug tree-optimization/107395] Missed warning opportunity on builtin string optimization

marxin at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Oct 25 19:28:17 GMT 2022


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

Martin Liška <marxin at gcc dot gnu.org> changed:

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

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Note C++ warns about it:

$ g++ pr107395.c -c
pr107395.c: In function ‘size_t f()’:
pr107395.c:4:29: error: initializer-string for ‘char [1]’ is too long
[-fpermissive]
    4 |                 char s[1] = "h";
      |                             ^~~
pr107395.c: In function ‘size_t f3()’:
pr107395.c:14:29: error: initializer-string for ‘char [2]’ is too long
[-fpermissive]
   14 |                 char s[2] = "hi";
      |                             ^~~~


More information about the Gcc-bugs mailing list