On Thu, Apr 10, 2025 at 05:17:51PM -0700, Keith Packard wrote: > A target using 16-bit ints won't have enough bits to hold the whole > flag_sanitize set. Be explicit about using uint32 for the attribute data. > > Signed-off-by: Keith Packard <kei...@keithp.com> > --- > gcc/c-family/c-attribs.cc | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/gcc/c-family/c-attribs.cc b/gcc/c-family/c-attribs.cc > index 5a0e3d328ba..2a4ae10838a 100644 > --- a/gcc/c-family/c-attribs.cc > +++ b/gcc/c-family/c-attribs.cc > @@ -1420,12 +1420,12 @@ add_no_sanitize_value (tree node, unsigned int flags) > if (flags == old_value) > return; > > - TREE_VALUE (attr) = build_int_cst (unsigned_type_node, flags); > + TREE_VALUE (attr) = build_int_cst (uint32_type_node, flags); > } > else > DECL_ATTRIBUTES (node) > = tree_cons (get_identifier ("no_sanitize"), > - build_int_cst (unsigned_type_node, flags), > + build_int_cst (uint32_type_node, flags), > DECL_ATTRIBUTES (node)); > }
This looks correct to me. Martin, is this something you (or someone else) can get committed for GCC 15? Thanks! -Kees P.S. Sorry for the double email Martin, it took me a while to find mbox; I'm not subscribed to gcc-patches. Thankfully the patchwork has it: https://patchwork.sourceware.org/project/gcc/patch/20250411001751.141494-1-kei...@keithp.com/ -- Kees Cook