From 3c526e70688b18f65568ef3b3ee235fd3a9c2c13 Mon Sep 17 00:00:00 2001 From: Roman Fomin Date: Thu, 23 Jun 2022 08:39:43 +0700 Subject: [PATCH] workaround for optimization bug in clang Taken from Eternity Engine, fixes desync in competn/doom/fp2-3655.lmp and dmn01m909.lmp --- CHANGELOG.md | 2 ++ src/r_main.c | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 48d5c21f..f99cbb91 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,3 +7,5 @@ * Check if the lump can be a Doom patch in `R_GenerateLookup()`. * Fix `gcc-12 -O3` compiler warnings. * Only create autoload subdirectory relative to `D_DoomPrefDir()`. +* Workaround for optimization bug in clang (taken from Eternity Engine, fixes + desync in competn/doom/fp2-3655.lmp and dmn01m909.lmp). diff --git a/src/r_main.c b/src/r_main.c index 9d0be21b..63c9f12e 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -116,7 +116,13 @@ void (*colfunc)(void) = R_DrawColumn; // current column draw function // killough 5/2/98: reformatted // +// Workaround for optimization bug in clang +// fixes desync in competn/doom/fp2-3655.lmp and in dmnsns.wad dmn01m909.lmp +#if defined(__clang__) +int R_PointOnSide(volatile fixed_t x, volatile fixed_t y, node_t *node) +#else int R_PointOnSide(fixed_t x, fixed_t y, node_t *node) +#endif { if (!node->dx) return x <= node->x ? node->dy > 0 : node->dy < 0;