FreeBSD Bugzilla – Attachment 212725 Details for
Bug 245075
www/varnish4: Fails to build with clang 10; "error: implicit conversion from 'long' to 'double' changes value from 9223372036854775807 to 9223372036854775808"
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for lib/libvmod_std/vmod_std_conversions.c
fix-long-to-double-rounding.patch (text/plain), 1.14 KB, created by
Laurence 'GreenReaper' Parry
on 2020-03-26 15:25:26 UTC
(
hide
)
Description:
Patch for lib/libvmod_std/vmod_std_conversions.c
Filename:
MIME Type:
Creator:
Laurence 'GreenReaper' Parry
Created:
2020-03-26 15:25:26 UTC
Size:
1.14 KB
patch
obsolete
>--- lib/libvmod_std/vmod_std_conversions.c 2020-03-26 10:41:39.510445000 -0400 >+++ lib/libvmod_std/vmod_std_conversions.c 2020-03-26 10:58:20.457448000 -0400 >@@ -45,6 +45,21 @@ > #include "vtim.h" > #include "vcc_if.h" > >+/* >+ * technically, as our VCL_INT is int64_t, its limits are INT64_MIN/INT64_MAX. >+ * >+ * Yet, for conversions, we use VNUMpfx with a double intermediate, so above >+ * 2^53 we see rounding errors. In order to catch a potential floor rounding >+ * error, we make our limit 2^53-1 >+ * >+ * Ref: https://stackoverflow.com/a/1848762 >+ */ >+#define VCL_INT_MAX ((INT64_C(1)<<53)-1) >+#define VCL_INT_MIN (-VCL_INT_MAX) >+ >+#define VCL_BYTES_MAX VCL_INT_MAX >+#define VCL_BYTES_MIN 0 >+ > VCL_DURATION __match_proto__(td_std_duration) > vmod_duration(VRT_CTX, VCL_STRING p, VCL_DURATION d) > { >@@ -195,7 +210,7 @@ > if (!isfinite(r)) > return (i); > r = round(r); >- if (r > LONG_MAX || r < LONG_MIN) >+ if (r > VCL_INT_MAX || r < VCL_INT_MIN) > return(i); > return ((long)r); > } >@@ -219,7 +234,7 @@ > if (!isfinite(t)) > return (i); > t = round(t); >- if (t > LONG_MAX || t < LONG_MIN) >+ if (t > VCL_INT_MAX || t < VCL_INT_MIN) > return(i); > return ((long)t); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 245075
:
212724
| 212725