Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array subscript 0 is outside bounds gcc warning in NtCurrentTeb on Cygwin #668

Open
ivmai opened this issue Oct 13, 2024 · 0 comments
Open

Comments

@ivmai
Copy link
Owner

ivmai commented Oct 13, 2024

Source: master (8311518)
Host: Win64 (cygwin64)
Compiler: gcc (13.3.1 or 12.4.0-3)
w32api-headers version: 12.0.0-1
Not reproduced on clang.
How to reproduce: gcc -I include -O2 -Wall -Wextra -Wpedantic -c misc.c

Output (of gcc):

In file included from /usr/include/w32api/winnt.h:27,
                 from /usr/include/w32api/minwindef.h:163,
                 from /usr/include/w32api/windef.h:9,
                 from /usr/include/w32api/windows.h:69,
                 from include/private/gc_priv.h:295,
                 from os_dep.c:18:
In function '__readgsqword',
    inlined from 'NtCurrentTeb' at /usr/include/w32api/winnt.h:10020:73,
    inlined from 'GC_get_stack_base' at os_dep.c:763:29:
/usr/include/w32api/psdk_inc/intrin-impl.h:838:1: warning: array subscript 0 is outside array bounds of 'long long unsigned int[0]' [-Warray-bounds=]
  838 | __buildreadseg(__readgsqword, unsigned __int64, "gs", "q")
      | ^~~~~~~~~~~~~~
In function 'GC_get_stack_base':
cc1: note: source object is likely at address zero
In function '__readgsqword',
    inlined from 'NtCurrentTeb' at /usr/include/w32api/winnt.h:10020:73,
    inlined from 'GC_get_stack_base' at os_dep.c:763:29,
    inlined from 'GC_get_main_stack_base' at os_dep.c:1640:7:
/usr/include/w32api/psdk_inc/intrin-impl.h:838:1: warning: array subscript 0 is outside array bounds of 'long long unsigned int[0]' [-Warray-bounds=]
  838 | __buildreadseg(__readgsqword, unsigned __int64, "gs", "q")
      | ^~~~~~~~~~~~~~
In function 'GC_get_main_stack_base':
cc1: note: source object is likely at address zero
@ivmai ivmai changed the title Array subscript 0 is outside array bounds gcc warning in NtCurrentTeb on Cygwin Array subscript 0 is outside bounds gcc warning in NtCurrentTeb on Cygwin Oct 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant