[Bug tree-optimization/48377] [4.6/4.7 regression] miscompilation at -O3

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jun 3 12:57:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48377

--- Comment #45 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-06-03 12:55:18 UTC ---
(In reply to comment #44)
> Created attachment 24423 [details]
> gcc46-pr48377.patch
> 
> I don't see why mode should be relevant, the MEM_REF should have from the type
> clear indication that it is unaligned load (or store) and just should lead to
> the bit-fieldish expansion.
> 
> Anyway, here is a testsuite patch for now, works on x86_64, not tested other
> targets.

The issue is (or at least was) that the mem-attrs get the alignment from
the alignment of the mode (for indirect-refs) unconditionally on strict-align
targets until

2010-12-30  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>

        * emit-rtl.c (set_mem_attributes_minus_bitpos): Explicitly derive
        default values from MEM mode if no memory attributes are present.
        Do not use mode alignment, even on STRICT_ALIGNMENT targets, when
        called with an expression (not a type).

and the indirect-ref path never went down the misaligned path as the
get_inner_reference path did.  This is a very old issue.  The only thing
MEM_REF improves here is that if the target has a movmisalign_optab it
is uses for such accesses, otherwise there will be simply a MEM RTX
with alingment less than the modes alignment which has no effect.

It is a genuine middle-end / target issue that we do not properly implement
this GCC extension for strict-align targets.



More information about the Gcc-bugs mailing list