diff options
author | Michael Panzlaff <michael.panzlaff@fau.de> | 2020-05-09 14:49:51 +0200 |
---|---|---|
committer | Michael Panzlaff <michael.panzlaff@fau.de> | 2020-07-05 18:09:59 +0200 |
commit | 3264cf697f5fe996c2a79c6c34181c186fe2f96e (patch) | |
tree | 919e94607188da2a6e561f41dfba39e3a7558b24 /src/berry_blender.c | |
parent | 46f4a4bbf7239743c333cd32d30b74a7b3176acc (diff) |
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.
Diffstat (limited to 'src/berry_blender.c')
-rw-r--r-- | src/berry_blender.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/berry_blender.c b/src/berry_blender.c index 2a122541d..4d3b7eb6f 100644 --- a/src/berry_blender.c +++ b/src/berry_blender.c @@ -2202,6 +2202,11 @@ static s16 sub_8081BD4(void) return sUnknown_03000E06; } +#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 static void Blender_CalculatePokeblock(struct BlenderBerry *berries, struct Pokeblock *pokeblock, u8 playersNo, u8 *flavors, u16 maxRPM) { s32 i, j; |