diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0a3fd7939dd..fc026c58ee7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-12-04 Richard Biener + + PR middle-end/68636 + * builtins.c (get_pointer_alignment_1): Take care of byte to + bit alignment computation overflow. + 2015-12-04 Richard Biener PR middle-end/67438 diff --git a/gcc/builtins.c b/gcc/builtins.c index 7c614e6336e..9d816044c73 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -458,6 +458,10 @@ get_pointer_alignment_1 (tree exp, unsigned int *alignp, { *bitposp = ptr_misalign * BITS_PER_UNIT; *alignp = ptr_align * BITS_PER_UNIT; + /* Make sure to return a sensible alignment when the multiplication + by BITS_PER_UNIT overflowed. */ + if (*alignp == 0) + *alignp = 1u << (HOST_BITS_PER_INT - 1); /* We cannot really tell whether this result is an approximation. */ return true; }