From: Jonathan Nieder <jrnieder@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Michael Cree <mcree@orcon.net.nz>,
git@vger.kernel.org, Nicolas Pitre <nico@fluxnic.net>
Subject: Re: [PATCH maint-1.6.5] block-sha1: avoid unaligned accesses on some big-endian systems
Date: Sat, 14 Jul 2012 14:50:22 -0500 [thread overview]
Message-ID: <20120714195022.GB23242@burratino> (raw)
In-Reply-To: <CA+55aFy+y=TCoJUQarinaduibt4i-46TAuvpp7fsAmjDZj_+3w@mail.gmail.com>
Linus Torvalds wrote:
> On Sat, Jul 14, 2012 at 12:59 AM, Jonathan Nieder <jrnieder@gmail.com> wrote:
>> Unfortunately, on big-endian architectures, if p is a pointer to
>> unsigned int then current gcc assumes it is properly aligned and
>> converts this construct to a 32-bit load.
>
> This patch seems to entirely depend on the location of the cast. And
> as far as I can tell, that workaround will in turn depend on just what
> gets inlined.
After the patch, what reason does gcc have to expect that 'block' is
32-bit aligned except when it is? The code (including the code I
didn't touch) never casts from char * to int * except in get/put_be32
on arches that don't mind unaligned accesses.
[...]
> Anyway, the whole "noticed on alpha" makes no sense, since alpha isn't
> even big-endian. So the commit log is insane and misleading too.
Yes, true. Thanks for catching it.
Jonathan
next prev parent reply other threads:[~2012-07-14 19:50 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20120713233957.6928.87541.reportbug@electro.phys.waikato.ac.nz>
[not found] ` <20120714002950.GA3159@burratino>
[not found] ` <5000CBCA.8020607@orcon.net.nz>
[not found] ` <20120714021856.GA3062@burratino>
[not found] ` <50010B84.5030606@orcon.net.nz>
2012-07-14 7:59 ` [PATCH maint-1.6.5] block-sha1: avoid unaligned accesses on some big-endian systems Jonathan Nieder
2012-07-14 19:11 ` Linus Torvalds
2012-07-14 19:50 ` Jonathan Nieder [this message]
2012-07-14 19:55 ` Linus Torvalds
2012-07-14 20:50 ` [PATCH maint-1.6.5 v2] block-sha1: avoid pointer conversion that violates alignment constraints Jonathan Nieder
2012-07-14 20:56 ` Linus Torvalds
2012-07-14 21:57 ` [PATCH] block-sha1: put macro arguments in parentheses Jonathan Nieder
2012-07-15 20:58 ` [PATCH maint-1.6.5 v2] block-sha1: avoid pointer conversion that violates alignment constraints Michael Cree
2012-07-15 21:27 ` Jonathan Nieder
2012-07-16 9:53 ` Michael Cree
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=20120714195022.GB23242@burratino \
--to=jrnieder@gmail.com \
--cc=git@vger.kernel.org \
--cc=mcree@orcon.net.nz \
--cc=nico@fluxnic.net \
--cc=torvalds@linux-foundation.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).