We fail to handle constant addresses in get_pointer_alignment_1 so we use too pessimistic alignment when accessing a packed structure via such a pointer.
Bootstrapped on x86_64-unknown-linux-gnu, testing in progress. Richard. 2012-07-13 Richard Guenther <rguent...@suse.de> PR middle-end/53937 * builtins.c (get_pointer_alignment_1): Handle constant pointers. Index: gcc/builtins.c =================================================================== --- gcc/builtins.c (revision 189451) +++ gcc/builtins.c (working copy) @@ -536,6 +536,13 @@ get_pointer_alignment_1 (tree exp, unsig return false; } } + else if (TREE_CODE (exp) == INTEGER_CST) + { + *alignp = BIGGEST_ALIGNMENT; + *bitposp = ((TREE_INT_CST_LOW (exp) * BITS_PER_UNIT) + & (BIGGEST_ALIGNMENT - 1)); + return true; + } *bitposp = 0; *alignp = BITS_PER_UNIT;