[Bug c/106797] Improvement: diagnose undefined behavior: not all declarations that refer to the same object or function have compatible type

pavel.morozkin at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Aug 31 19:28:17 GMT 2022


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

--- Comment #2 from Pavel M <pavel.morozkin at gmail dot com> ---
Observation: if "static" is removed, then GCC generates:
<source>: In function 'f2':
<source>:10:18: error: conflicting types for 'x'; have 'int (*)[5]'
   10 |     extern int (*x)[5];
      |                  ^
<source>:5:18: note: previous declaration of 'x' with type 'int (*)[3]'
    5 |     extern int (*x)[3];
      |


More information about the Gcc-bugs mailing list