This fixes PR54031. While technically the source is invalid (a pointer is not aligned as it should) it wasn't my plan to exploit this with the get_object_alignment change. In fact it is CCPs wrongdoing that it uses get_object_alignment_1 instead of get_pointer_alignemnt_1 when looking at a pointer.
Bootstrapped on x86_64-unknown-linux-gnu, testing in progress. Richard. 2012-07-20 Richard Guenther <rguent...@suse.de> PR tree-optimization/54031 * tree-ssa-ccp.c (get_value_from_alignment): Use get_pointer_alignment_1. Index: gcc/tree-ssa-ccp.c =================================================================== *** gcc/tree-ssa-ccp.c (revision 189704) --- gcc/tree-ssa-ccp.c (working copy) *************** get_value_from_alignment (tree expr) *** 510,516 **** gcc_assert (TREE_CODE (expr) == ADDR_EXPR); ! get_object_alignment_1 (TREE_OPERAND (expr, 0), &align, &bitpos); val.mask = double_int_and_not (POINTER_TYPE_P (type) || TYPE_UNSIGNED (type) ? double_int_mask (TYPE_PRECISION (type)) --- 510,516 ---- gcc_assert (TREE_CODE (expr) == ADDR_EXPR); ! get_pointer_alignment_1 (expr, &align, &bitpos); val.mask = double_int_and_not (POINTER_TYPE_P (type) || TYPE_UNSIGNED (type) ? double_int_mask (TYPE_PRECISION (type))