This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]