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

Ignore new gcc version mask array bounds warning #3186

Merged
merged 1 commit into from
Oct 31, 2024

Conversation

ankith26
Copy link
Member

Compiler: gcc version 14.2.0 (Ubuntu 14.2.0-4ubuntu2)

A new warning popped up in mask.c. Seems like a bit of a false positive, but the code is doing weird stuff anyways, so taking the easiest way out by silencing that warning on mask.c

@ankith26 ankith26 requested a review from a team as a code owner October 20, 2024 18:22
@yunline yunline added the build Compiling stuff label Oct 21, 2024
@bilhox
Copy link
Contributor

bilhox commented Oct 30, 2024

but the code is doing weird stuff anyways

@ankith26 What does the warning message say ?

@ankith26
Copy link
Member Author

  FAILED: src_c/mask.cpython-312-x86_64-linux-gnu.so.p/bitmask.c.o
  cc -Isrc_c/mask.cpython-312-x86_64-linux-gnu.so.p -Isrc_c -I../src_c -I/usr/include/SDL2 -I/usr/include/python3.12 -I/usr/include/x86_64-linux-gnu/python3.12 -fvisibility=hidden -fdiagnostics-color=always -DNDEBUG -D_FILE_OFFSET_BITS=64 -O3 -DPG_MAJOR_VERSION=2 -DPG_MINOR_VERSION=5 -DPG_PATCH_VERSION=3 '-DPG_VERSION_TAG=".dev1"' -Wall -Wno-error=unknown-pragmas -fPIC -D_REENTRANT -Werror -MD -MQ src_c/mask.cpython-312-x86_64-linux-gnu.so.p/bitmask.c.o -MF src_c/mask.cpython-312-x86_64-linux-gnu.so.p/bitmask.c.o.d -o src_c/mask.cpython-312-x86_64-linux-gnu.so.p/bitmask.c.o -c ../src_c/bitmask.c
  ../src_c/bitmask.c: In function ‘bitmask_create’:
  ../src_c/bitmask.c:132:9: error: array subscript ‘bitmask_t {aka struct bitmask}[0]’ is partly outside array bounds of ‘unsigned char[8]’ [-Werror=array-bounds=]
    132 |     temp->w = w;
        |         ^~
  ../src_c/bitmask.c:126:12: note: object of size 8 allocated by ‘malloc’
    126 |     temp = malloc(size);
        |            ^~~~~~~~~~~~
  ../src_c/bitmask.c:133:9: error: array subscript ‘bitmask_t {aka struct bitmask}[0]’ is partly outside array bounds of ‘unsigned char[8]’ [-Werror=array-bounds=]
    133 |     temp->h = h;
        |         ^~
  ../src_c/bitmask.c:126:12: note: object of size 8 allocated by ‘malloc’
    126 |     temp = malloc(size);
        |            ^~~~~~~~~~~~
  In function ‘bitmask_create’,
      inlined from ‘bitmask_copy’ at ../src_c/bitmask.c:159:17:
  ../src_c/bitmask.c:132:13: error: array subscript ‘bitmask_t {aka struct bitmask}[0]’ is partly outside array bounds of ‘unsigned char[8]’ [-Werror=array-bounds=]
    132 |     temp->w = w;
        |     ~~~~~~~~^~~
  ../src_c/bitmask.c:126:12: note: object of size 8 allocated by ‘malloc’
    126 |     temp = malloc(size);
        |            ^~~~~~~~~~~~
  ../src_c/bitmask.c:133:13: error: array subscript ‘bitmask_t {aka struct bitmask}[0]’ is partly outside array bounds of ‘unsigned char[8]’ [-Werror=array-bounds=]
    133 |     temp->h = h;
        |     ~~~~~~~~^~~
  ../src_c/bitmask.c:126:12: note: object of size 8 allocated by ‘malloc’
    126 |     temp = malloc(size);
        |            ^~~~~~~~~~~~
  cc1: all warnings being treated as errors

Copy link
Member

@Starbuck5 Starbuck5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm okay with this.

Copy link
Member

@zoldalma999 zoldalma999 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

@zoldalma999 zoldalma999 merged commit 27a103a into main Oct 31, 2024
25 checks passed
@zoldalma999 zoldalma999 added this to the 2.5.3 milestone Oct 31, 2024
@ankith26 ankith26 deleted the ankith26-fix-new-gcc-warning branch October 31, 2024 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Compiling stuff
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants