From 7e6ba6a2a56e6195da36329bdeb1654e20aad198 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Fri, 3 Jun 2022 22:40:21 +0930 Subject: [PATCH] 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. --- gas/config/tc-i386.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) -- 2.30.2