1 From: Lukas Schwaighofer <lukas@schwaighofer.name>
2 Date: Tue, 26 Feb 2019 23:13:58 +0100
3 Subject: Prevent optimizing the pow() function
5 With the current GCC 8.2.0 from Debian, a section of code calling pow() in
6 zzjson_parse.c is turned into a sequence calling exp(). Since no exp()
7 implementation is available in syslinux those optimizations need to be
10 com32/gpllib/zzjson/zzjson_parse.c | 6 +++++-
11 1 file changed, 5 insertions(+), 1 deletion(-)
13 diff --git a/com32/gpllib/zzjson/zzjson_parse.c b/com32/gpllib/zzjson/zzjson_parse.c
14 index ecb6f61..e66a9d8 100644
15 --- a/com32/gpllib/zzjson/zzjson_parse.c
16 +++ b/com32/gpllib/zzjson/zzjson_parse.c
17 @@ -138,6 +138,10 @@ static ZZJSON *parse_string2(ZZJSON_CONFIG *config) {
21 +static double __attribute__((optimize("O0"))) pow_noopt(double x, double y) {
25 static ZZJSON *parse_number(ZZJSON_CONFIG *config) {
27 unsigned long long ival = 0, expo = 0;
28 @@ -213,7 +217,7 @@ skipexpo:
30 dval = sign * (long long) ival;
32 - dval *= pow(10.0, (double) signexpo * expo);
33 + dval *= pow_noopt(10.0, (double) signexpo * expo);
36 zzjson = config->calloc(1, sizeof(ZZJSON));