[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20120406.124344.564538802640968013.davem@davemloft.net>
Date: Fri, 06 Apr 2012 12:43:44 -0400 (EDT)
From: David Miller <davem@...emloft.net>
To: arvid.brodin@...a.com
Cc: shemminger@...tta.com, netdev@...r.kernel.org,
balferreira@...glemail.com, arvid.brodin@...n.com
Subject: Re: [RFC] net/hsr: Add support for IEC 62439-3 High-availability
Seamless Redundancy
From: Arvid Brodin <arvid.brodin@...a.com>
Date: Fri, 6 Apr 2012 17:51:24 +0200
> Just out of curiosity, what's the mechanism behind this inline
> assignment that turns the memcpy into an unaligned access? If gcc is
> "smart" enough to detect a bunch of char * accesses and turn them
> into unaligned 32-bit accesses, isn't that a bug in gcc?
It's not doing it with "char *", it's doing it with other types like
the type of the ICMP header in this case.
memcpy is expanded by the compiler internally into __builtin_memcpy()
which if it sees the length is reasonably short will inline the
copy. And subsequently it uses the alignment of the types involved
to determine what kinds of loads and stores it can use in that
inline memcpy().
So the result is that just because in your case with your compiler
it doesn't get expanded inline and fault, it doesn't mean it won't
for someone else.
You're just lucky, and you really haven't fixed the bug.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists