[patch] Fix unaligned accesses generated by IVOPTS

Eric Botcazou ebotcazou@adacore.com
Mon Apr 26 08:34:00 GMT 2010


Hi,

this is the bug discussed at http://gcc.gnu.org/ml/gcc/2010-04/msg00178.html

As reported by DJ, IVOPTS can generate unaligned accesses on strict alignment 
machines because may_be_unaligned_p overlooks the variable part of the offset 
in the reference it is passed.  The attached C testcase raises a SIGBUS on 
SPARC/Solaris at -O2 with all 4.x versions I tested (4.1, 4.3, 4.5, 4.6) but 
not with 3.4 so this is an old regression.

Bootstrapped/regtested on SPARC/Solaris and SPARC64/Solaris.  OK for mainline 
and for which branches?


2010-04-26  Eric Botcazou  <ebotcazou@adacore.com>

	* tree-ssa-loop-ivopts.c (may_be_unaligned_p): Check the alignment of
	the variable part of the offset as well.  Use highest_pow2_factor for
	all alignment checks.


2010-04-26  DJ Delorie  <dj@redhat.com>

	* gcc.c-torture/execute/20100426-1.c: New test.


-- 
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-diff
Size: 976 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100426/54f7c0e5/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t.c
Type: text/x-csrc
Size: 905 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100426/54f7c0e5/attachment-0001.bin>


More information about the Gcc-patches mailing list