aboutsummaryrefslogtreecommitdiff
path: root/gcc/builtins.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r--gcc/builtins.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 72b6d305b21..166abbeea02 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -497,6 +497,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;
}