From: Alan Modra Date: Thu, 2 Jun 2022 06:40:30 +0000 (+0930) Subject: ubsan: undefined shift in frag_align_code X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e0ad09cfa5f0672ee917de2c56a27427e6908220;p=binutils-gdb.git ubsan: undefined shift in frag_align_code * frags.c (MAX_MEM_FOR_RS_ALIGN_CODE): Avoid signed integer overflow. --- diff --git a/gas/frags.c b/gas/frags.c index f5afe1a49b5..8e88496f37c 100644 --- a/gas/frags.c +++ b/gas/frags.c @@ -367,7 +367,7 @@ frag_align_pattern (int alignment, const char *fill_pattern, # ifndef HANDLE_ALIGN # define MAX_MEM_FOR_RS_ALIGN_CODE 1 # else -# define MAX_MEM_FOR_RS_ALIGN_CODE ((1 << alignment) - 1) +# define MAX_MEM_FOR_RS_ALIGN_CODE (((size_t) 1 << alignment) - 1) # endif #endif