From 5505978ab31300aa02f321f97af9512916ed8595 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Fri, 4 Dec 2015 08:17:50 +0000 Subject: [PATCH] re PR rtl-optimization/68636 (unnecessary unaligned load on mips o32) 2015-12-04 Richard Biener PR middle-end/68636 * builtins.c (get_pointer_alignment_1): Take care of byte to bit alignment computation overflow. From-SVN: r231246 --- gcc/ChangeLog | 6 ++++++ gcc/builtins.c | 4 ++++ 2 files changed, 10 insertions(+) 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; } -- 2.30.2