113.0-1
[arch-packages.git] / syslinux / repos / core-x86_64 / 0018-prevent-pow-optimization.patch
blob0c42c7bbb3901f51c25543ae3fe7ce74e65e3cc2
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
8 disabled.
9 ---
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) {
18 return zzjson;
21 +static double __attribute__((optimize("O0"))) pow_noopt(double x, double y) {
22 + return pow(x, y);
25 static ZZJSON *parse_number(ZZJSON_CONFIG *config) {
26 ZZJSON *zzjson;
27 unsigned long long ival = 0, expo = 0;
28 @@ -213,7 +217,7 @@ skipexpo:
29 if (dbl) {
30 dval = sign * (long long) ival;
31 dval += sign * frac;
32 - dval *= pow(10.0, (double) signexpo * expo);
33 + dval *= pow_noopt(10.0, (double) signexpo * expo);
36 zzjson = config->calloc(1, sizeof(ZZJSON));