This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch] Fix PR 5582 and 10538, missed uninitialized variablewarning
- From: Jason Merrill <jason at redhat dot com>
- To: Andrew Pinski <pinskia at physics dot uc dot edu>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sun, 17 Aug 2003 09:33:35 -0400
- Subject: Re: [Patch] Fix PR 5582 and 10538, missed uninitialized variablewarning
- References: <C3A005EC-D06F-11D7-B2E3-000393A6D2F2@physics.uc.edu>
On Sun, 17 Aug 2003 01:00:47 -0400, Andrew Pinski <pinskia@physics.uc.edu> wrote:
> This is a follow up with my pervious patch which did not compile at all in
> any non C language.
> This fixes PR 5582 only when pedantic is on because it as a GCC extension
> to do int i = i; to turn off the uninitialized warnings for that
> variable.
I don't think it makes sense for this to be conditional on -pedantic;
warnings have nothing to do with standards conformance. As the PR
suggests, this should be controlled by a -Wno- flag.
> I also do not warn about int *x = &x; because x is initialized.
Right.
> There is one case where I warn when we should not: int *x = &(x+2);.
That code is ill-formed; x+2 isn't an lvalue, so you can't take its address.
Jason