This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: GCC 2.95.2 -- warning where there is no reason for one
- To: vakatov at peony dot nlm dot nih dot gov
- Subject: Re: GCC 2.95.2 -- warning where there is no reason for one
- From: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Date: Wed, 12 Apr 2000 22:44:41 +0200
- CC: gcc-bugs at gcc dot gnu dot org
- References: <38F3A7AE.8F5A4E5F@peony.nlm.nih.gov>
> // Although I have obviously exhausted all legitimate variants of
> // enumerator "EMy e" in the switch, however I still get this
Thanks for your bug report. This is not a bug, but an implementation
limitation:
`-Wuninitialized'
...
These warnings are made optional because GCC is not smart enough
to see all the reasons why the code might be correct despite
appearing to have an error. Here is one example of how this can
happen:
{
int x;
switch (y)
{
case 1: x = 1;
break;
case 2: x = 4;
break;
case 3: x = 5;
}
foo (x);
}
If the value of `y' is always 1, 2 or 3, then `x' is always
initialized, but GCC doesn't know this.
Regards,
Martin