From: Alan Modra Date: Fri, 3 Jun 2022 13:10:21 +0000 (+0930) Subject: Re: ubsan: undefined shift in frag_align_code X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7e6ba6a2a56e6195da36329bdeb1654e20aad198;p=binutils-gdb.git Re: ubsan: undefined shift in frag_align_code This one needs the same fix too. * config/tc-i386.h (MAX_MEM_FOR_RS_ALIGN_CODE): Avoid signed integer overflow. --- diff --git a/gas/config/tc-i386.h b/gas/config/tc-i386.h index d7c6b33c778..817539ea560 100644 --- a/gas/config/tc-i386.h +++ b/gas/config/tc-i386.h @@ -207,7 +207,8 @@ if ((n) \ goto around; \ } -#define MAX_MEM_FOR_RS_ALIGN_CODE (alignment ? ((1 << alignment) - 1) : 1) +#define MAX_MEM_FOR_RS_ALIGN_CODE \ + (alignment ? ((size_t) 1 << alignment) - 1 : (size_t) 1) extern void i386_cons_align (int); #define md_cons_align(nbytes) i386_cons_align (nbytes)