https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68064
--- Comment #6 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Hmm, I can't make much sense of get_pointer_alignment_1 returning 0. I suppose
this happens because here:
else if (TREE_CODE (exp) == SSA_NAME
&& POINTER_TYPE_P (TREE_TYPE (exp)))
{
unsigned int ptr_align, ptr_misalign;
struct ptr_info_def *pi = SSA_NAME_PTR_INFO (exp);
if (pi && get_ptr_info_alignment (pi, &ptr_align, &ptr_misalign))
{
*bitposp = ptr_misalign * BITS_PER_UNIT;
*alignp = ptr_align * BITS_PER_UNIT;
/* We cannot really tell whether this result is an approximation. */
return true;
}
else
{
*bitposp = 0;
*alignp = BITS_PER_UNIT;
return false;
}
}
because we get overflow when computing ptr_misalign * BITS_PER_UNIT.
I think get_pointer_alignment should prevent that. It knows how to deal with
constant:
else if (TREE_CODE (exp) == INTEGER_CST)
{
*alignp = BIGGEST_ALIGNMENT;
*bitposp = ((TREE_INT_CST_LOW (exp) * BITS_PER_UNIT)
& (BIGGEST_ALIGNMENT - 1));
return true;
}
so I guess the code handling SSA_NAME should also cap to BIGGEST_ALIGNMENT.