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

Re: GCC feature req: warn when bitops exceed type size (was: conntrack untracked match is broken)


On Mon, Jun 29, 2009 at 3:10 PM, Jan Engelhardt<jengelh@medozas.de> wrote:
> Hi gcc list,
>
>
> I am forwarding below's bugreport here(*), to implicitly make aware
> of a feature that I deem important to have in a future gcc.
>

-Wconversion should say

t.c:4: warning: conversion to ‘unsigned char’ from ‘int’ may alter its value

>
> (*) should have posted to bugzilla instead? Don't feel like setting
> up a bugmenot tho..
>
> ---------- Forwarded message ----------
> Date: Mon, 29 Jun 2009 14:34:10
> From: Patrick McHardy
> To: Jan Engelhardt
> Cc: Netfilter Developer Mailing List <netfilter-devel@vger.kernel.org>,
> ? ?Philip Craig
> Subject: Re: conntrack untracked match is broken (kernel patch)
>
>>On Monday 2009-06-22 08:31, Philip Craig wrote:
>>>The problem is that state_mask in 'struct xt_conntrack_mtinfo1' is
>>>only 8 bit, but XT_CONNTRACK_STATE_UNTRACKED == 256.
>>>Unfortunately, gcc doesn't warn about this for '|=', only for '='.
>
> [i.e. uint8_t x = 0; x |= 256; ]
>
>>
>>I smell a gcc-missing-feature there.
>


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