fix aggressive loop optimizations

Previously, aggressive loop optimizations with a new compiler were not
possible due to undefined behaviour at end of arrays.

A macro "UBFIX" is added to allow ifdefs for fixes which resolve
undefined behavior. For example newer GCC versions will detect various
bugs in the original game code and will otherwise not compile with -Werror.
This commit is contained in:
Michael Panzlaff
2020-05-09 14:49:51 +02:00
parent 46f4a4bbf7
commit 3264cf697f
10 changed files with 79 additions and 45 deletions
+5
View File
@@ -3209,6 +3209,11 @@ static u32 sub_8024568(__attribute__((unused)) struct BerryCrushGame *r0, __attr
return 0;
}
#if MODERN
// TODO remove this as soon as the code below is understood
// add a UBFIX if required (code buggy?)
__attribute__((optimize("no-aggressive-loop-optimizations")))
#endif
void sub_8024578(struct BerryCrushGame *r4)
{
u8 r5 = 0;