chishm / nitrohax

NitroHax cheat tool for Nintendo DS
GNU General Public License v3.0
45 stars 34 forks source link

Does not compile with devkitARM-r56-3 #13

Closed lifehackerhansol closed 2 years ago

lifehackerhansol commented 2 years ago

At this time of writing, the latest version of devkitARM is r56-3 according to Ubuntu's dkp-pacman.

This specific line is causing a compiler issue:

/mnt/c/Users/lifehackerhansol/Documents/Git/nitrohax/BootLoader/source/main.arm9.c:72:27: error: '__builtin_memset' offset [0, 98303] is out of the bounds [0, 0] [-Werror=array-bounds]
   72 |                 VRAM_A[i] = 0x0000;

Removing -Werror from makefile returns no other warnings, though it does throw a lot of linker errors specifically with the enums, which is fixable by switching to typedef enum which I had fixed in a PR to NTR Launcher.

I'm not too sure how to handle this myself, so I'm leaving it as an issue here.

lifehackerhansol commented 2 years ago

The same issues happen in arm9 as well (outside of BootLoader), for these particular files:

/mnt/c/Users/lifehackerhansol/Documents/Git/nitrohax/arm9/source/ui.cpp: In constructor 'UserInterface::UserInterface()':
/mnt/c/Users/lifehackerhansol/Documents/Git/nitrohax/arm9/source/ui.cpp:155:47: warning: 'void* __builtin_memset(void*, int, unsigned int)' offset [0, 31] is out of the bounds [0, 0] [-Warray-bounds]
  155 |                 ((u16*)CHAR_BASE_BLOCK(4))[i] = 0;
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/mnt/c/Users/lifehackerhansol/Documents/Git/nitrohax/arm9/source/ui.cpp:180:31: warning: 'void* __builtin_memset(void*, int, unsigned int)' offset [0, 2047] is out of the bounds [0, 0] [-Warray-bounds]
  180 |                 fontMapSub[i] = 0;
      |                 ~~~~~~~~~~~~~~^~~
/mnt/c/Users/lifehackerhansol/Documents/Git/nitrohax/arm9/source/ui.cpp:190:32: warning: 'void* __builtin_memset(void*, int, unsigned int)' offset [0, 255] is out of the bounds [0, 0] [-Warray-bounds]
  190 |                 tileDestSub[i] = 0;
      |                 ~~~~~~~~~~~~~~~^~~
/mnt/c/Users/lifehackerhansol/Documents/Git/nitrohax/arm9/source/ui.cpp:194:30: warning: 'void* __builtin_memset(void*, int, unsigned int)' offset [0, 1535] is out of the bounds [0, 0] [-Warray-bounds]
  194 |                 guiSubMap[i] = 0;
      |                 ~~~~~~~~~~~~~^~~
/mnt/c/Users/lifehackerhansol/Documents/Git/nitrohax/arm9/source/cheat_engine.c: In function 'runCheatEngine':
/mnt/c/Users/lifehackerhansol/Documents/Git/nitrohax/arm9/source/cheat_engine.c:47:9: warning: 'memset' offset [0, 131071] is out of the bounds [0, 0] [-Warray-bounds]
   47 |         memset (LCDC_BANK_C, 0x00, 128 * 1024);
chishm commented 2 years ago

Thank you for the bug report. I'll have to dig into this a bit more, but it looks like changes introduced with GCC 11 are causing it.

chishm commented 2 years ago

This problem should be fixed now. Please let me know if you have any other problems.

I also came across the same enum issue you did, and fixed it with enum ERROR_CODES {...} instead of enum {...} ERROR_CODES, for consistency with how other enums are defined.