[PATCH 1/6] Cygwin: Suppress array-bounds warning from NtCurrentTeb()
Corinna Vinschen
corinna-cygwin@cygwin.com
Mon Aug 5 10:11:03 GMT 2024
On Aug 4 22:48, Jon Turney wrote:
> This disables a warning seen with gcc 12 caused by intrinsics used by
> the inline implementation of NtCurrentTeb() inside w32api headers.
>
> > In function ‘long long unsigned int __readgsqword(unsigned int)’,
> > inlined from ‘_TEB* NtCurrentTeb()’ at /usr/include/w32api/winnt.h:10020:86,
> > [...]
> > /usr/include/w32api/psdk_inc/intrin-impl.h:838:1: error: array subscript 0 is outside array bounds of ‘long long unsigned int [0]’ [-Werror=array-bounds]
>
> See also: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105523#c6
> ---
> winsup/cygwin/local_includes/winlean.h | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/winsup/cygwin/local_includes/winlean.h b/winsup/cygwin/local_includes/winlean.h
> index 5bf1be262..62b651be6 100644
> --- a/winsup/cygwin/local_includes/winlean.h
> +++ b/winsup/cygwin/local_includes/winlean.h
> @@ -53,7 +53,10 @@ details. */
> #define __undef_CRITICAL
> #endif
>
> +#pragma GCC diagnostic push
> +#pragma GCC diagnostic ignored "-Warray-bounds"
> #include <windows.h>
> +#pragma GCC diagnostic pop
> #include <wincrypt.h>
> #include <lmcons.h>
> #include <ntdef.h>
> --
> 2.45.1
Looks like every other way to workaround this is worse. Please push.
Thanks,
Corinna
More information about the Cygwin-patches
mailing list