https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=a0482c612cec8648620989fa54583bdcb0c0b3f5
commit a0482c612cec8648620989fa54583bdcb0c0b3f5 Author: Jon Turney <[email protected]> Date: Sun Aug 4 15:51:07 2024 +0100 Cygwin: Suppress array-bounds warning from NtCurrentTeb() 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 Signed-off-by: Jon Turney <[email protected]> Diff: --- 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>
