public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug regression/55759] New: bogus warning when building drivers/ata/libata-core.c in v3.7 of the linux kernel
@ 2012-12-20 15:36 bp at alien8 dot de
  2012-12-20 15:43 ` [Bug regression/55759] " rguenth at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: bp at alien8 dot de @ 2012-12-20 15:36 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55759
           Summary: bogus warning when building drivers/ata/libata-core.c
                    in v3.7 of the linux kernel
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: regression
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: bp@alien8.de


Hi,

when building kernel v3.7 with Debian's gcc: (Debian 4.7.2-4) 4.7.2, I
get the following warning:

$  make CC=gcc-4.7 drivers/ata/libata-core.o
make[1]: Nothing to be done for `all'.
make[1]: Nothing to be done for `relocs'.
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CC      kernel/bounds.s
  GEN     include/generated/bounds.h
  CC      arch/x86/kernel/asm-offsets.s
  GEN     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  CC      scripts/mod/empty.o
  MKELF   scripts/mod/elfconfig.h
  HOSTCC  scripts/mod/file2alias.o
  HOSTCC  scripts/mod/modpost.o
  HOSTCC  scripts/mod/sumversion.o
  HOSTLD  scripts/mod/modpost
  CC      drivers/ata/libata-core.o
drivers/ata/libata-core.c: In function ‘ata_hpa_resize’:
drivers/ata/libata-core.c:1397:3: warning: ‘native_sectors’ may be used
uninitialized in this function [-Wmaybe-uninitialized]
$

it falsely complains that native_sectors might be used unitialized. The
variable's value is assigned-to in an auxiliary function and passed to
it as a pointer.

The auxiliary function returns negative value on error and 0 on success
and its caller uses the native_sectors value returned over the pointer
only in the success case and in that case, native_sectors is always
properly initialized.

Also, gcc-4.6 (gcc-4.6 (Debian 4.6.3-14) 4.6.3) doesn't trigger that
same warning:

$  make CC=gcc-4.6 drivers/ata/libata-core.o
make[1]: Nothing to be done for `all'.
make[1]: Nothing to be done for `relocs'.
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CALL    scripts/checksyscalls.sh
  CC      drivers/ata/libata-core.o
$

Thanks.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug regression/55759] bogus warning when building drivers/ata/libata-core.c in v3.7 of the linux kernel
  2012-12-20 15:36 [Bug regression/55759] New: bogus warning when building drivers/ata/libata-core.c in v3.7 of the linux kernel bp at alien8 dot de
@ 2012-12-20 15:43 ` rguenth at gcc dot gnu.org
  2012-12-20 16:20 ` bp at alien8 dot de
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-12-20 15:43 UTC (permalink / raw)
  To: gcc-bugs


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2012-12-20
     Ever Confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> 2012-12-20 15:43:24 UTC ---
Please provide preprocessed source.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug regression/55759] bogus warning when building drivers/ata/libata-core.c in v3.7 of the linux kernel
  2012-12-20 15:36 [Bug regression/55759] New: bogus warning when building drivers/ata/libata-core.c in v3.7 of the linux kernel bp at alien8 dot de
  2012-12-20 15:43 ` [Bug regression/55759] " rguenth at gcc dot gnu.org
@ 2012-12-20 16:20 ` bp at alien8 dot de
  2012-12-20 16:38 ` markus at trippelsdorf dot de
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: bp at alien8 dot de @ 2012-12-20 16:20 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #2 from Boris <bp at alien8 dot de> 2012-12-20 16:20:34 UTC ---
Created attachment 29015
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29015
gzipped preprocessed source of drivers/ata/libata-core.c


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug regression/55759] bogus warning when building drivers/ata/libata-core.c in v3.7 of the linux kernel
  2012-12-20 15:36 [Bug regression/55759] New: bogus warning when building drivers/ata/libata-core.c in v3.7 of the linux kernel bp at alien8 dot de
  2012-12-20 15:43 ` [Bug regression/55759] " rguenth at gcc dot gnu.org
  2012-12-20 16:20 ` bp at alien8 dot de
@ 2012-12-20 16:38 ` markus at trippelsdorf dot de
  2012-12-20 18:34 ` markus at trippelsdorf dot de
  2013-11-20  0:42 ` law at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: markus at trippelsdorf dot de @ 2012-12-20 16:38 UTC (permalink / raw)
  To: gcc-bugs


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

Markus Trippelsdorf <markus at trippelsdorf dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |markus at trippelsdorf dot
                   |                            |de

--- Comment #3 from Markus Trippelsdorf <markus at trippelsdorf dot de> 2012-12-20 16:38:04 UTC ---
It only happens with -Os, -O2 is fine.
gcc-4.8 is also affected.
I'm reducing this testcase right now.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug regression/55759] bogus warning when building drivers/ata/libata-core.c in v3.7 of the linux kernel
  2012-12-20 15:36 [Bug regression/55759] New: bogus warning when building drivers/ata/libata-core.c in v3.7 of the linux kernel bp at alien8 dot de
                   ` (2 preceding siblings ...)
  2012-12-20 16:38 ` markus at trippelsdorf dot de
@ 2012-12-20 18:34 ` markus at trippelsdorf dot de
  2013-11-20  0:42 ` law at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: markus at trippelsdorf dot de @ 2012-12-20 18:34 UTC (permalink / raw)
  To: gcc-bugs


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 %


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug regression/55759] bogus warning when building drivers/ata/libata-core.c in v3.7 of the linux kernel
  2012-12-20 15:36 [Bug regression/55759] New: bogus warning when building drivers/ata/libata-core.c in v3.7 of the linux kernel bp at alien8 dot de
                   ` (3 preceding siblings ...)
  2012-12-20 18:34 ` markus at trippelsdorf dot de
@ 2013-11-20  0:42 ` law at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: law at redhat dot com @ 2013-11-20  0:42 UTC (permalink / raw)
  To: gcc-bugs

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

Jeffrey A. Law <law at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #5 from Jeffrey A. Law <law at redhat dot com> ---
-Os was changed to throttle jump threading as the block copying can result in
larger code.  With jump threading throttled, unexecutable paths are left in the
CFG which reduces the preciseness of warnings such as Wuninitialized.

Tracking via BZ 42145, but not expecting to fix it anytime soon.

*** This bug has been marked as a duplicate of bug 42145 ***


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-11-20  0:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-20 15:36 [Bug regression/55759] New: bogus warning when building drivers/ata/libata-core.c in v3.7 of the linux kernel bp at alien8 dot de
2012-12-20 15:43 ` [Bug regression/55759] " rguenth at gcc dot gnu.org
2012-12-20 16:20 ` bp at alien8 dot de
2012-12-20 16:38 ` markus at trippelsdorf dot de
2012-12-20 18:34 ` markus at trippelsdorf dot de
2013-11-20  0:42 ` law at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).