https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118194
--- Comment #8 from vvinayag at arm dot com --- (In reply to Sam James from comment #6) > (In reply to vvinayag from comment #5) > > (In reply to Sam James from comment #4) > > > (In reply to Xi Ruoyao from comment #1) > > > > I suppose Glibc should add __attribute__((access(1, none))) for mlock. > > > > > > commit 013106ae677af9836614ace1a01d25b63fa555a7 (HEAD -> master, > > > origin/master, origin/HEAD) > > > Author: Xi Ruoyao <xry...@xry111.site> > > > Date: Thu Dec 26 12:51:18 2024 +0800 > > > > > > mlock, mlock2, munlock: Tell the compiler we don't dereference the > > > pointer > > > > > > Since https://gcc.gnu.org/r11-959, the compiler emits > > > -Wmaybe-uninitialized if a const pointer to an uninitialized buffer is > > > passed. Tell the compiler we don't dereference the pointer to remove > > > the false alarm. > > > > > > Link: https://gcc.gnu.org/PR118194 > > > Signed-off-by: Xi Ruoyao <xry...@xry111.site> > > > Reviewed-by: Sam James <s...@gentoo.org> > > > > > > After this commit, there is a build failure : > > > > ../sysdeps/unix/sysv/linux/bits/mman-shared.h:60:5: error: attribute > > ‘access’ invalid mode ‘__none__’; expected one of ‘read_only’, ‘read_write’, > > or ‘write_only’ > > 60 | __attr_access ((__none__, 1)); > > | ^~~~~~~~~~~~~ > > Can you replace the line with: > __attr_access_none (1); > and let me know if it helps? Sorry for the delay. Yes, this fixed the build failure for me, when using commit e9be7701e6cd2b7be5454efaece3abc7ec9102ce