This is the mail archive of the gcc-bugs@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]

[Bug middle-end/20968] Spurious "may be used uninitialized" warning


------- 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


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