Commit 445a6ba4 by Richard Guenther Committed by Richard Biener

re PR target/26721 (Gcc generates unaligned access)

2006-03-17  Richard Guenther  <rguenther@suse.de>

	PR middle-end/26721
	* builtins.c (get_pointer_alignment): For component style references
	adjust alignment to the component type alignment.  Make sure
	to adjust alignment for component access of constants.

From-SVN: r112177
parent d550ef0b
2006-03-17 Richard Guenther <rguenther@suse.de>
PR middle-end/26721
* builtins.c (get_pointer_alignment): For component style references
adjust alignment to the component type alignment. Make sure
to adjust alignment for component access of constants.
2006-03-17 David Edelsohn <edelsohn@gnu.org>
* config/rs6000/rs6000.md (strlensi): Emit barrier after
......
......@@ -278,8 +278,13 @@ get_pointer_alignment (tree exp, unsigned int max_align)
inner = max_align;
while (handled_component_p (exp))
{
/* Fields in a structure can be packed, honour DECL_ALIGN
of the FIELD_DECL. For all other references the conservative
alignment is the element type alignment. */
if (TREE_CODE (exp) == COMPONENT_REF)
inner = MIN (inner, DECL_ALIGN (TREE_OPERAND (exp, 1)));
else
inner = MIN (inner, TYPE_ALIGN (TREE_TYPE (exp)));
exp = TREE_OPERAND (exp, 0);
}
if (TREE_CODE (exp) == FUNCTION_DECL)
......@@ -288,7 +293,7 @@ get_pointer_alignment (tree exp, unsigned int max_align)
align = MIN (inner, DECL_ALIGN (exp));
#ifdef CONSTANT_ALIGNMENT
else if (CONSTANT_CLASS_P (exp))
align = CONSTANT_ALIGNMENT (exp, align);
align = MIN (inner, (unsigned)CONSTANT_ALIGNMENT (exp, align));
#endif
else
align = MIN (align, inner);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment