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 regression/55759] bogus warning when building drivers/ata/libata-core.c in v3.7 of the linux kernel


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55759

--- Comment #4 from Markus Trippelsdorf <markus at trippelsdorf dot de> 2012-12-20 18:34:19 UTC ---
This is what creduce came up with:

markus@x4 /tmp % cat test.i
struct ata_taskfile
{
    int feature;
};
struct ata_eh_info
{
    int flags;
};
struct ata_eh_context
{
    struct ata_eh_info i;
};
struct
{
    struct ata_eh_context eh_context;
}
g, n;
int a, c, e, f, m, o;
void fn1 (char *, ...);
int fn2 ();
int fn3 ();
static int
fn4 (long long *p1)
{
    struct ata_taskfile b;
    if (a && b.feature)
        return 1;
    *p1 = fn3 ();
    return 0;
}

static int
fn5 ()
{
    struct ata_taskfile d;
    if (c && d.feature)
        return -13;
    return 0;
}

static int
fn6 ()
{
    struct ata_eh_context h = g.eh_context;
    int i = h.i.flags, l;
    _Bool j = f;
    long long k;
    l = fn4 (&k);
    if (l)
        return 0;
    if (e || j)
        return 0;
    l = fn5 ();
    if (l == -13)
        return 0;
    if (l)
        return 1;
    l = fn2 ();
    if (l)
        if (i)
            fn1 ("HPA  >   %llu\n", k);
    return 0;
}

int
fn7 ()
{
    struct ata_eh_context p = n.eh_context;
    int q = p.i.flags;
    o = 0;
    m = fn6 ();
    goto err_out_nosup;
    if (q)
err_out_nosup:
        return 0;
}
markus@x4 /tmp % gcc -c -Wall -Os test.i
test.i: In function âfn7â:
test.i:61:17: warning: âkâ may be used uninitialized in this function
[-Wmaybe-uninitialized]
             fn1 ("HPA  >   %llu\n", k);
                 ^
test.i:47:15: note: âkâ was declared here
     long long k;
               ^
markus@x4 /tmp % gcc -c -Wall test.i
markus@x4 /tmp % gcc -c -Wall -O2 test.i
markus@x4 /tmp % /usr/x86_64-pc-linux-gnu/gcc-bin/4.6.3/gcc -c -Wall -Os test.i
markus@x4 /tmp % /usr/x86_64-pc-linux-gnu/gcc-bin/4.7.2/gcc -c -Wall -Os test.i
test.i: In function âfn7â:
test.i:61:17: warning: âkâ may be used uninitialized in this function
[-Wmaybe-uninitialized]
test.i:47:15: note: âkâ was declared here
markus@x4 /tmp % /usr/x86_64-pc-linux-gnu/gcc-bin/4.7.2/gcc -c -Wall -O2 test.i
markus@x4 /tmp %


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