* GCC feature req: warn when bitops exceed type size (was: conntrack untracked match is broken)
@ 2009-06-29 13:59 Jan Engelhardt
2009-06-29 14:06 ` Richard Guenther
0 siblings, 1 reply; 5+ messages in thread
From: Jan Engelhardt @ 2009-06-29 13:59 UTC (permalink / raw)
To: gcc
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.
(*) 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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GCC feature req: warn when bitops exceed type size (was: conntrack untracked match is broken)
2009-06-29 13:59 GCC feature req: warn when bitops exceed type size (was: conntrack untracked match is broken) Jan Engelhardt
@ 2009-06-29 14:06 ` Richard Guenther
2009-06-29 16:25 ` Manuel López-Ibáñez
0 siblings, 1 reply; 5+ messages in thread
From: Richard Guenther @ 2009-06-29 14:06 UTC (permalink / raw)
To: Jan Engelhardt; +Cc: gcc
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.
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GCC feature req: warn when bitops exceed type size (was: conntrack untracked match is broken)
2009-06-29 14:06 ` Richard Guenther
@ 2009-06-29 16:25 ` Manuel López-Ibáñez
2009-06-29 19:02 ` Jan Engelhardt
0 siblings, 1 reply; 5+ messages in thread
From: Manuel López-Ibáñez @ 2009-06-29 16:25 UTC (permalink / raw)
To: Richard Guenther; +Cc: Jan Engelhardt, gcc
2009/6/29 Richard Guenther <richard.guenther@gmail.com>:
> 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
From GCC 4.4.0 it says:
bug.c:6: warning: conversion to ‘uint8_t’ from ‘int’ may alter its value
More info abut new Wconversion: http://gcc.gnu.org/wiki/NewWconversion
Cheers,
Manuel.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GCC feature req: warn when bitops exceed type size (was: conntrack untracked match is broken)
2009-06-29 16:25 ` Manuel López-Ibáñez
@ 2009-06-29 19:02 ` Jan Engelhardt
2009-06-30 2:08 ` Manuel López-Ibáñez
0 siblings, 1 reply; 5+ messages in thread
From: Jan Engelhardt @ 2009-06-29 19:02 UTC (permalink / raw)
To: Manuel López-Ibáñez; +Cc: Richard Guenther, gcc
On Monday 2009-06-29 16:09, Manuel López-Ibáñez wrote:
>2009/6/29 Richard Guenther wrote:
>> On Mon, Jun 29, 2009 at 3:10 PM, Jan Engelhardt 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
I added -Wconversion to the Linux kernel's global cflags (KBUILD_CFLAGS)
just to see what would happen. As I expected, I get swamped with
warnings, like "conversion to int from unsigned int". All legitimate in
themselves, I would have preferred an option (or even no option at all,
given that the "large integer implicitly truncated to unsigned type"
warning is shown without any -W flags) that only flags up truncation
problems with literals.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GCC feature req: warn when bitops exceed type size (was: conntrack untracked match is broken)
2009-06-29 19:02 ` Jan Engelhardt
@ 2009-06-30 2:08 ` Manuel López-Ibáñez
0 siblings, 0 replies; 5+ messages in thread
From: Manuel López-Ibáñez @ 2009-06-30 2:08 UTC (permalink / raw)
To: Jan Engelhardt; +Cc: gcc
2009/6/29 Jan Engelhardt <jengelh@medozas.de>:
>
> On Monday 2009-06-29 16:09, Manuel López-Ibáñez wrote:
>>2009/6/29 Richard Guenther wrote:
>>> On Mon, Jun 29, 2009 at 3:10 PM, Jan Engelhardt 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
>
> I added -Wconversion to the Linux kernel's global cflags (KBUILD_CFLAGS)
> just to see what would happen. As I expected, I get swamped with
> warnings, like "conversion to int from unsigned int". All legitimate in
> themselves, I would have preferred an option (or even no option at all,
> given that the "large integer implicitly truncated to unsigned type"
> warning is shown without any -W flags) that only flags up truncation
> problems with literals.
A lot of false warnings were fixed in GCC 4.4 and 4.5. And if only
truncation problems with literals were warned then your original
example wouldn't had been.
Cheers,
Manuel.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-06-29 21:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-29 13:59 GCC feature req: warn when bitops exceed type size (was: conntrack untracked match is broken) Jan Engelhardt
2009-06-29 14:06 ` Richard Guenther
2009-06-29 16:25 ` Manuel López-Ibáñez
2009-06-29 19:02 ` Jan Engelhardt
2009-06-30 2:08 ` Manuel López-Ibáñez
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).