[Bug middle-end/10138] warn for uninitialized arrays passed as const* arguments
h dot b dot furuseth at usit dot uio dot no
gcc-bugzilla@gcc.gnu.org
Mon Aug 20 22:46:00 GMT 2007
------- Comment #22 from h dot b dot furuseth at usit dot uio dot no 2007-08-20 22:45 -------
Subject: Re: warn for uninitialized arrays passed as const* arguments
manu at gcc dot gnu dot org writes:
> But it seems that the current policy of GCC is to not assume that such
> functions actually take this into account, since when optimizing
> constants are not propagated beyond a call to such function. This is
> either the intended behaviour or a missed-optimisation.
> It would be nice if it would be a missed-optimisation.
A "const" in a function parameter in C is not a promise to the compiler;
it would break the C standard to optimize on it.
> Otherwise, if this
> is the intended behaviour, then both PRs are invalid as Andrew said.
They are requests for warning messages, not error messages, because they
are _likely_ to be programmer errors. That's what warnings are for.
-Wuninitialized is giving false positives anyway, on code which the
compiler cannot tell is correct but the programmer can.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10138
More information about the Gcc-bugs
mailing list