在 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(__readfsdword, unsigned __LONG32, "fs", "l")
       | ^~~~~~~~~~~~~~


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 casting the input offset to a pointer to an array of unknown bound. So instead of writing

  [offset] "m" ((*(y *) (size_t) Offset))

we write

  [offset] "m" ((*(y (*)[]) (size_t) Offset))


Unfortunately Clang does not like this:

  test.c:5:53: error: dereference of pointer to incomplete type 'unsigned 
long[]'

Probably some conditional macros are necessary.



--
Best regards,
LIU Hao

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to