[Bug middle-end/78915] missing -Wuninitialized accessing allocated memory

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Apr 1 20:58:27 GMT 2021


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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
   Target Milestone|---                         |11.0
      Known to fail|                            |10.2.0, 7.3.0, 8.3.0, 9.2.0
             Status|NEW                         |RESOLVED

--- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> ---
Both f1() and f2() have been diagnosed since r11-959 (GCC 11):

$ gcc -O1 -S -Wall pr78915.c
pr78915.c: In function ‘f0’:
pr78915.c:5:3: warning: ‘i’ is used uninitialized [-Wuninitialized]
    5 |   ++i;
      |   ^~~
pr78915.c:3:7: note: ‘i’ was declared here
    3 |   int i;
      |       ^
pr78915.c: In function ‘f1’:
pr78915.c:14:5: warning: ‘*p’ is used uninitialized [-Wuninitialized]
   14 |   ++*p;
      |     ^~
pr78915.c: In function ‘f2’:
pr78915.c:25:5: warning: ‘*p’ may be used uninitialized [-Wmaybe-uninitialized]
   25 |   ++*p;
      |     ^~


More information about the Gcc-bugs mailing list