This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch for various warnings in gcc
- From: Michael Matz <matz at suse dot de>
- To: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- Cc: <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 8 Aug 2002 20:39:25 +0200 (CEST)
- Subject: Re: Patch for various warnings in gcc
Hi,
On 8 Aug 2002, Gabriel Dos Reis wrote:
> I agree in principle. While your __attribute__(()) proposal is
> certainly a far better alternative of what has been proposed, I think that
> the compiler should be instructred about value/condition propogation
> and not warn in cases the variable is "manifestly" initialized -- but
> GCC is insisting on warning just because it didn't do a good job at
> propagating conditions.
Just note, that it's strictly impossible to do this. Look at this:
int f(int a)
{ int b;
if (a)
b = 2;
return b;
}
And some invariant about the program ensures, that f() is only called with
non-zero arguments. gcc can't proove that b gets initialized,
nevertheless the programmer knows this. So some solution is anyway
necessary IMHO. An attribute sounds appealing.
Ciao,
Michael.