Re: [PATCH] i386, nmi: signed vs unsigned mixup

From: Jesper Juhl (jesper.juhl_at_gmail.com)
Date: 11/21/05

  • Next message: Uwe Zeisberger: "Re: make kernelrelease ignoring LOCALVERSION_AUTO"
    Date:	Mon, 21 Nov 2005 11:40:38 +0100
    To: Andrew Morton <akpm@osdl.org>
    
    

    On 11/20/05, Jesper Juhl <jesper.juhl@gmail.com> wrote:
    > On 11/20/05, Andrew Morton <akpm@osdl.org> wrote:
    [snip]
    > >
    > > Sure, go for it - let's see what the patches end up looking like. We might
    > > find real bugs in there - I found a bunch of howlers back in 2.3.late.
    > > That was with `gcc -W' which turns on more than -Wsigned-compare.
    > >
    > > Maybe you could prepare a quick overall summary first, see if you can work
    > > out the overall scope of the problem and then we can take a look at that,
    > > decide what bits to attack?
    > >
    > Sure, I'll do that tomorrow.
    > All these sign issues all over annoy me :)
    > I'll try to get a handle on the scope of the thing tomorrow, then send
    > a mail with what I find, then we can talk about what would be useful
    > to do.
    >

    Ok, I did an allyesconfig build (x86 build) of 2.6.15-rc2 with
    -Wsign-compare and I have some numbers.

    The total number of warnings for the build ended up at 14681
    Of course some of the warnings are not related to sign issues, so
    let's look at just

    comparison between signed and unsigned (12378 instances of this one)
    signed and unsigned type in conditional expression (2109 instances
    of this one)
    comparison of promoted ~unsigned with constant (4 instances of this one)

    So for the signedness related warnings we have a total of 14491 warnings.
    The 14491 warnings come from a total of 1701 files.

    This looks like a lot, but it's really not as bad as it looks since a
    lot of the warnings are duplicates.

    Let's take a look at the top 10 offenders :

    1)
    4078 counts of
    warning: comparison between signed and unsigned
    from include/asm/bitops.h:339

    2)
    1125 counts of
    warning: comparison between signed and unsigned
    from include/linux/netdevice.h:796

    3)
    256 counts of
    warning: signed and unsigned type in conditional expression
    from drivers/scsi/aic7xxx/aic79xx_osm_pci.c:79

    4)
    256 counts of
    warning: signed and unsigned type in conditional expression
    from drivers/scsi/aic7xxx/aic79xx_osm_pci.c:77

    5)
    120 counts of
    warning: signed and unsigned type in conditional expression
    from fs/xfs/xfs_mount.h:458

    6)
    90 counts of
    warning: comparison between signed and unsigned
    from include/net/tcp_ecn.h:53

    7)
    90 counts of
    warning: comparison between signed and unsigned
    from include/net/tcp.h:866

    8)
    90 counts of
    warning: signed and unsigned type in conditional expression
    from include/net/tcp.h:1148

    9)
    90 counts of
    warning: signed and unsigned type in conditional expression
    from include/net/tcp.h:1143

    10)
    86 counts of
    warning: comparison between signed and unsigned
    from include/linux/fb.h:859

    So, if we just cleaned up the top 10 offenders we'd get rid of 6281
    out of the total 14491 warnings.

    I've not yet looked at what would be involved in fixing these top 10,
    I'll look at that later, for now I just wanted to post the numbers I
    had.

    --
    Jesper Juhl <jesper.juhl@gmail.com>
    Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
    Plain text mails only, please      http://www.expita.com/nomime.html
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at  http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at  http://www.tux.org/lkml/
    

  • Next message: Uwe Zeisberger: "Re: make kernelrelease ignoring LOCALVERSION_AUTO"

    Relevant Pages

    • Differing signedness warnings when compiling ruby-odbc.
      ... of warnings that "pointer targets in passing argument x of y differ in ... signedness". ... odbc.c:761: warning: pointer targets in passing argument 4 of ...
      (comp.lang.ruby)
    • Net::RawIP
      ... RawIP.xs:278: warning: 'return' with no value, ... RawIP.xs:355: warning: pointer targets in passing argument 3 of ... 'Perl_sv_setpvn' differ in signedness ...
      (perl.beginners)
    • Re: Error: Installing ruby on rails in ubuntu
      ... How are you trying to install it? ... regex.c:1017: warning: pointer targets in initialization differ in ...
      (Ubuntu)
    • (no subject)
      ... epson.c:49: warning: pointer targets in passing argument 1 of ‘sprintf’ differ ...
      (Fedora)
    • Re: Example Needed
      ... [snip OP's drivel] ... sample.c: warning C4127: conditional expression is constant ... PRINTSIZE(signed short int); ...
      (comp.lang.c)