This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GCC feature req: warn when bitops exceed type size (was: conntrack untracked match is broken)
- From: Richard Guenther <richard dot guenther at gmail dot com>
- To: Jan Engelhardt <jengelh at medozas dot de>
- Cc: gcc at gnu dot org
- Date: Mon, 29 Jun 2009 15:13:01 +0200
- Subject: Re: GCC feature req: warn when bitops exceed type size (was: conntrack untracked match is broken)
- References: <alpine.LSU.2.00.0906291506130.21909@fbirervta.pbzchgretzou.qr>
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.
>