From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] [RFC] arm: fix memset-related crashes caused by recent GCC (4.7.2) optimizations
Date: Wed, 6 Mar 2013 01:42:55 +0000 [thread overview]
Message-ID: <20130306014255.GA20971@mudshark.cambridge.arm.com> (raw)
In-Reply-To: <5135F80E.3070307@gmail.com>
Hi Dirk,
On Tue, Mar 05, 2013 at 01:50:06PM +0000, Dirk Behme wrote:
> On 12.02.2013 17:36, Will Deacon wrote:
> > On Tue, Feb 12, 2013 at 03:58:01PM +0000, Russell King - ARM Linux wrote:
> >> On Tue, Feb 12, 2013 at 02:00:08PM +0000, Will Deacon wrote:
> >>> Interesting... the GCC documentation also states that ffreestanding implies
> >>> fno-builtin, so memset and co shouldn't be targetted for this sort of
> >>> optimisation by GCC. Have you observed this problem even when passing this
> >>> option?
> >>
> >> Rather than wondering whether we should be using -ffreestanding or not
> >> (which, x86 people have strongly resisted) I suggest that we just fix
> >> our memset() implementation to be compliant.
> >>
> >> The reason it's not compliant is that I saw no reason for it to be
> >> compliant back in the gcc 2.7.x days, and it's persisted like that for
> >> the last 19-ish years. If GCC is now making use of the return value,
> >> then we need to fix that and undo the "optimization" in our string.h.
> >>
> >> So let's just bite the bullet, make the asm memset() compliant, and
> >> clean up string.h.
> >
> > That would be the ideal thing to do, because it allows the compiler to
> > optimise around these functions, however it does mean we need to check/fix
> > *all* of the string functions at least (if we don't pass -fno-builtin then
> > any builtin function is up for optimisation, including strcpy etc).
>
> Do we already have an agreed solution for this issue anywhere, now?
I thought that the conclusion was to go with Ivan's suggestion since memset
is the only function which doesn't follow what the compiler expects.
Will
next prev parent reply other threads:[~2013-03-06 1:42 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-02 8:33 [PATCH] [RFC] arm: fix memset-related crashes caused by recent GCC (4.7.2) optimizations Ivan Djelic
2013-02-09 11:05 ` Ivan Djelic
2013-02-09 14:48 ` Nicolas Pitre
2013-02-11 12:35 ` Ivan Djelic
2013-02-11 18:17 ` Ben Dooks
2013-02-11 21:39 ` Ivan Djelic
2013-02-11 18:41 ` Will Deacon
2013-02-11 19:42 ` Ivan Djelic
2013-02-12 14:00 ` Will Deacon
2013-02-12 15:58 ` Russell King - ARM Linux
2013-02-12 16:36 ` Will Deacon
2013-02-12 16:37 ` Russell King - ARM Linux
2013-02-12 16:38 ` Will Deacon
2013-03-05 13:50 ` Dirk Behme
2013-03-06 1:42 ` Will Deacon [this message]
2013-03-06 7:05 ` Dirk Behme
2013-03-06 17:11 ` Russell King - ARM Linux
2013-03-06 17:38 ` Dirk Behme
2013-03-06 18:43 ` Russell King - ARM Linux
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=20130306014255.GA20971@mudshark.cambridge.arm.com \
--to=will.deacon@arm.com \
--cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).