Re: Bogus warning when comparing nocast short variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 21, 2010 at 9:51 AM, Pavel Roskin <proski@xxxxxxx> wrote:
> Hello!
>
> This test file causes a warning:
>
> typedef short __attribute__((nocast)) u16;
> int main(int argc, char **argv)
> {
>        u16 i = (u16)argc;
>        u16 j = (u16)2;
>        return (i == j);
> }
>
> $ sparse test1.c
> test1.c:6:17: warning: implicit cast from nocast type
> test1.c:6:22: warning: implicit cast from nocast type

The warning come from the implicit cast in the compare
expression. It try to cast "i" and "j" into "int" type before the
compare.

The following patch allow the test-inspect to show the cast
expression.

No patch for the fix yet.

Chris

Attachment: inspect-cast.patch
Description: Binary data


[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux