This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Can the gcc 3.x code be cleaned up to avoid unnecessary warning m
- From: Nix <nix at esperi dot demon dot co dot uk>
- To: Joe Buck <Joe dot Buck at synopsys dot com>
- Cc: Martin dot Hughes at uk dot thalesgroup dot com (Hughes, Martin), gcc at gnu dot org ('gcc at gnu dot org')
- Date: 30 May 2002 23:38:58 +0100
- Subject: Re: Can the gcc 3.x code be cleaned up to avoid unnecessary warning m
- References: <200205291656.JAA20788@atrus.synopsys.com>
On Wed, 29 May 2002, Joe Buck yowled:
> void proc(int foo)
> {
> int flag;
> if (foo) {
> flag = result_of_some_boolean_function();
> }
> some_other_code();
> if (foo) {
> if (flag)
> do_something();
> else
> do_something_else();
> }
> }
>
> gcc will complain that flag can be used uninitialized, which is not
> correct.
One hopes that when SSA gets used more heavily, GCC's tracking of
variable-lifetime information will get good enough to detect this
particular case, at least.
(But of course if the `foo's are different but the first conditional is
always true when the second is true, I'd not expect any C compiler, no
matter how smart, to realise that flag was only used initialized.)
--
`What happened?'
`Nick shipped buggy code!'
`Oh, no dinner for him...'