[Bug tree-optimization/118194] [12/13/14/15 regression] spurious warning with -Wmaybe-uninitialized with mlock since r11-959-gb825a22890740f
vvinayag at arm dot com
gcc-bugzilla@gcc.gnu.org
Fri Jan 3 13:55:28 GMT 2025
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 <xry111@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 <xry111@xry111.site>
> > > Reviewed-by: Sam James <sam@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
More information about the Gcc-bugs
mailing list