[Bug c/45467] gcc won't warn about an uninitialized value

manu at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Aug 31 20:38:00 GMT 2010



------- Comment #8 from manu at gcc dot gnu dot org  2010-08-31 20:37 -------
(In reply to comment #7)
> Updated code snippet, GCC doesn't warn here either if we leave `#if 0' as-is,
> even though the function foo() may have side-effects.

No, the function below does not have any side-effects. The result of the
program is the same whether the function runs or not because the return value
is ignored. To have a side-effect you need to write/print, change global
memory, or affect the return value of the program.

Until then, this is invalid. Please, reopen when you have a valid testcase
(there are bugs in Wuninitialized, so I wouldn't be surprised if you find one).


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu dot org
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |WORKSFORME


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45467



More information about the Gcc-bugs mailing list