This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: __builtin_memcpy and alignment assumptions
- From: Eric Botcazou <ebotcazou at libertysurf dot fr>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: gcc at gcc dot gnu dot org, Richard Biener <richard dot guenther at gmail dot com>, Steve Ellcey <sellcey at imgtec dot com>
- Date: Fri, 08 Jan 2016 12:40:51 +0100
- Subject: Re: __builtin_memcpy and alignment assumptions
- Authentication-results: sourceware.org; auth=none
- References: <5e991791-a201-4b8d-89fd-78db873368c7 at BAMAIL02 dot ba dot imgtec dot org> <1482639 dot JCa9WsCs7z at polaris> <20160108113220 dot GT18720 at tucnak dot redhat dot com>
> I think we only assume it if the pointer is actually dereferenced, otherwise
> it just breaks too much code in the wild. And while memcpy dereferences,
> it dereferences it through a char * cast, and thus only the minimum
> alignment is assumed.
Yet the compiler was generating the expected code for Steve's testcase on
strict-alignment architectures until very recently (GCC 4.5 IIUC) and this
worked perfectly.
The irony of this very questionable change is that it was made to support some
corner cases with SSE on x86 but of course the compiler generates the expected
code for Steve's testcase on x86 because it is _not_ strict-alignment...
--
Eric Botcazou