ubsan: undefined shift in frag_align_code

* frags.c (MAX_MEM_FOR_RS_ALIGN_CODE): Avoid signed integer
	overflow.
This commit is contained in:
Alan Modra
2022-06-02 16:10:30 +09:30
parent 53f2b36a54
commit e0ad09cfa5

View File

@ -367,7 +367,7 @@ frag_align_pattern (int alignment, const char *fill_pattern,
# ifndef HANDLE_ALIGN # ifndef HANDLE_ALIGN
# define MAX_MEM_FOR_RS_ALIGN_CODE 1 # define MAX_MEM_FOR_RS_ALIGN_CODE 1
# else # 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
#endif #endif