Hello,
This was a known issue that ended up getting fixed in 4.20- for any optimized builds, the compiler would inline the static threshold variable.
This was fixed with these two commits:
39d28a352200e06ce7876252982741d2d90725d7 (initial fix)
92959b84d9e59cbd7c1dd6126716382fa9dbc1b4 (include path fix) Hope this helps!