[Bug middle-end/78355] LRA generates unaligned accesses when SLOW_UNALIGNED_ACCESS is 1

ebotcazou at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Nov 15 09:42:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78355

--- Comment #3 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #2)
> 	  if (!SLOW_UNALIGNED_ACCESS (mode, MEM_ALIGN (reg))
> 	      || (MEM_ALIGN (reg) < GET_MODE_ALIGNMENT (innermode)
>                   && SLOW_UNALIGNED_ACCESS (innermode, MEM_ALIGN (reg)))
> 	      || MEM_ALIGN (reg) >= GET_MODE_ALIGNMENT (mode))
> 	    return true;
> 
> looks good to me given
> 
> gcc/defaults.h:#define SLOW_UNALIGNED_ACCESS(MODE, ALIGN) STRICT_ALIGNMENT
> 
> doesn't do that check itself (maybe it and all ports should be fixed
> instead...)

The documentation for SLOW_UNALIGNED_ACCESS implicitly says that it's for
unaligned accesses only:

 -- Macro: SLOW_UNALIGNED_ACCESS (MODE, ALIGNMENT)
     Define this macro to be the value 1 if memory accesses described
     by the MODE and ALIGNMENT parameters have a cost many times greater
     than aligned accesses, for example if they are emulated in a trap
     handler.

and all other uses of SLOW_UNALIGNED_ACCESS in the compiler do it correctly, so
it's an isolated bug in lra-constraints.c.  That being said, I can make the
wording in the documentation stronger.


More information about the Gcc-bugs mailing list