Re: [Mingw-w64-public] -Warray-bounds warning for __readfsdword and __readgsqword

2022-06-29 Thread LIU Hao
在 2022/6/30 00:24, Ozkan Sezer 写道: Lazy solution for me would be something like the following: Does it look correct? #if defined(__MINGW32__) && defined(__x86_64__) #undef NtCurrentTeb #define NtCurrentTeb MI_NtCurrentTeb struct _TEB * MI_NtCurrentTeb(void) { void *ret; __asm__ __volatile

Re: [Mingw-w64-public] -Warray-bounds warning for __readfsdword and __readgsqword

2022-06-29 Thread Ozkan Sezer
On 6/29/22, LIU Hao wrote: > The compiler sees > > := *(unsigned long*) 42 > > which itself is indeed dereferencing a strange pointer. Probably GCC should > warn about only pointers > to known data. Lazy solution for me would be something like the following: Does it look correct? #if define

[Mingw-w64-public] (no subject)

2022-06-29 Thread Ozkan Sezer
> The compiler sees > > := *(unsigned long*) 42 > > which itself is indeed dereferencing a strange pointer. Probably GCC should > warn about only pointers > to known data. Lazy solution for me would be something like the following: Does it look correct? #if defined(__MINGW32__) && defined(__

Re: [Mingw-w64-public] -Warray-bounds warning for __readfsdword and __readgsqword

2022-06-29 Thread LIU Hao
在 2022-06-29 22:48, Ozkan Sezer 写道: Well, I'm not proficient with gcc inline asm. So, whatever you guys think is best. Also: is this not actually a gcc bug? Are they aware of it? I don't think they are aware of it. Please file a report if you think it is necessary. The compiler sees

Re: [Mingw-w64-public] -Warray-bounds warning for __readfsdword and __readgsqword

2022-06-29 Thread Ozkan Sezer
On 6/29/22, Ozkan Sezer wrote: > On 6/29/22, LIU Hao wrote: >> I have been aware of this too. The asm statement is passed an indirection >> by >> a constant offset in >> the FS/GS segment, which itself is valid, but GCC thinks it was about the >> default DS segment and >> fails to calculate its s

Re: [Mingw-w64-public] -Warray-bounds warning for __readfsdword and __readgsqword

2022-06-29 Thread Ozkan Sezer
On 6/29/22, LIU Hao wrote: > I have been aware of this too. The asm statement is passed an indirection by > a constant offset in > the FS/GS segment, which itself is valid, but GCC thinks it was about the > default DS segment and > fails to calculate its size. > > > This may be solved for GCC by c

Re: [Mingw-w64-public] -Warray-bounds warning for __readfsdword and __readgsqword

2022-06-29 Thread LIU Hao
在 2022-06-29 19:51, Ozkan Sezer 写道: Noticed this in github CI runs of vkQuake. Is the warning bogus? D:/a/_temp/msys64/mingw32/include/psdk_inc/intrin-impl.h:2164:1: warning: array subscript 0 is outside array bounds of 'long unsigned int[0]' [-Warray-bounds] 2164 | __buildreadseg(__readfsdwor

[Mingw-w64-public] -Warray-bounds warning for __readfsdword and __readgsqword

2022-06-29 Thread Ozkan Sezer
Noticed this in github CI runs of vkQuake. Is the warning bogus? In function '__readfsdword', inlined from 'NtCurrentTeb' at D:/a/_temp/msys64/mingw32/include/winnt.h:2438:27, inlined from '_mi_thread_id' at mimalloc/mimalloc-internal.h:814:21, inlined from '_mi_is_main_thread' at mima