From e0ad09cfa5f0672ee917de2c56a27427e6908220 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Thu, 2 Jun 2022 16:10:30 +0930 Subject: [PATCH] ubsan: undefined shift in frag_align_code * frags.c (MAX_MEM_FOR_RS_ALIGN_CODE): Avoid signed integer overflow. --- gas/frags.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- 2.30.2