This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/20968] Spurious "may be used uninitialized" warning
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Apr 2005 14:49:21 -0000
- Subject: [Bug middle-end/20968] Spurious "may be used uninitialized" warning
- References: <20050412140415.20968.James.Juran@baesystems.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-04-12 14:49 -------
Note this is not fully a regression but really a progression.
What is happening now is only partial optimizations is happen before the warning to happen.
>I was unable to reduce the test case further without making the warning
>disappear. In particular, removing the increment of v1->count makes the warning
>disappear.
This is because we would then jump thread he jump.
Again this is because we are emitting the warning too soon, I might be able to come up with a testcase
which shows that this is not really a regression but a progression in that we have warned in 3.4 and
4.0:
struct {int count;} *v1;
int c;
int k;
extern void baz(int);
void foo(void)
{
int i;
int r;
if (k == 4)
{
i = 1;
r = 1;
}
else
r = 0;
if (!r)
{
if (!c)
return;
v1->count++;
}
if (!c)
{
baz(i);
}
}
There is no different from the case above and the functions you gave below.
There has been some talking about moving where we warn about uninitialized variables but I feel that
you can get around this in your code.
--
What |Removed |Added
----------------------------------------------------------------------------
Component|c |middle-end
Summary|[4.0/4.1 Regression] |Spurious "may be used
|Spurious "may be used |uninitialized" warning
|uninitialized" warning |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20968