From: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
To: Scott Wood <scottwood-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
Cc: devicetree-discuss
<devicetree-discuss-mnsaURCQ41sdnm+yROfE0A@public.gmane.org>,
Stephen Papacharalambous
<SteveP-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
Subject: Re: [PATCH] Fix an overflow case in fdt_offset_ptr() detected by GCC 4.3.
Date: Wed, 1 Oct 2008 11:19:42 +1000 [thread overview]
Message-ID: <20081001011942.GC30810@yookeroo.seuss> (raw)
In-Reply-To: <48E253A2.1090702-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
On Tue, Sep 30, 2008 at 11:28:18AM -0500, Scott Wood wrote:
> David Gibson wrote:
>> On Mon, Sep 29, 2008 at 08:51:02PM -0500, Jon Loeliger wrote:
>>>> On Mon, Sep 29, 2008 at 04:13:27PM -0500, Jon Loeliger wrote:
>>>> Uh.. Jon.. did you see my reply to this. I'm not at all convinced
>>>> this patches a real problem. I suspect it's just replacing a problem
>>>> that gcc could detect with a similar one that gcc can't (and for which
>>>> we already had a test to deal with, anyway).
>>> I saw your reply, and you are welcome to read up
>>> on the fist fight over in GCC land too.
>>>
>>> In the meantime, it fixes a real problem that we
>>> have at Freescale.
>>
>> Ok.. and can you explain this real problem?
>>
>> If this is just to work around a silly gcc warning that appears in
>> some circumstances and not others, that's fine, but the commit message
>> should say so.
>
> It seems that the C standard says that signed overflow is undefined, but
> not unsigned overflow. Presumably that was to accomodate
> non-twos-complement machines (which we don't really care about), but GCC
> abuses it to completely optimize away any paths that depend on such
> overflow, and the fact that they had to add a warning about it didn't
> strike them as a reason why they should maybe not go ahead with such an
> optimization by default, even if it's permitted by the spec.
Ah, ok! The old C undefined behaviour problem. Ok, now this patch
makes sense - we were indeed assuming that overflow behaved as you'd
expect for a two's complement machine
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
prev parent reply other threads:[~2008-10-01 1:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-25 16:02 [PATCH] Fix an overflow case in fdt_offset_ptr() detected by GCC 4.3 Jon Loeliger
2008-09-26 1:29 ` David Gibson
2008-09-29 21:13 ` Jon Loeliger
[not found] ` <E1KkQ3b-0000uT-6H-CYoMK+44s/E@public.gmane.org>
2008-09-30 1:15 ` David Gibson
[not found] ` <20080930011525.GB6189-787xzQ0H9iRg7VrjXcPTGA@public.gmane.org>
2008-09-30 1:51 ` Jon Loeliger
[not found] ` <E1KkUOE-0001OX-EF-CYoMK+44s/E@public.gmane.org>
2008-09-30 2:39 ` David Gibson
[not found] ` <20080930023934.GB8939-787xzQ0H9iRg7VrjXcPTGA@public.gmane.org>
2008-09-30 8:03 ` Steve Papacharalambous
2008-09-30 16:28 ` Scott Wood
[not found] ` <48E253A2.1090702-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2008-10-01 1:19 ` David Gibson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081001011942.GC30810@yookeroo.seuss \
--to=david-xt8fgy+axnrb3ne2bgzf6laj5h9x9tb+@public.gmane.org \
--cc=SteveP-KZfg59tc24xl57MIdRCFDg@public.gmane.org \
--cc=devicetree-discuss-mnsaURCQ41sdnm+yROfE0A@public.gmane.org \
--cc=scottwood-KZfg59tc24xl57MIdRCFDg@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox