Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Mar 2020 15:24:08 +0000
From:      bugzilla-noreply@freebsd.org
To:        ports-bugs@FreeBSD.org
Subject:   [Bug 245075] www/varnish4: Fails to build with clang 10; "error: implicit conversion from 'long' to 'double' changes value from 9223372036854775807 to 9223372036854775808"
Message-ID:  <bug-245075-7788@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D245075

            Bug ID: 245075
           Summary: www/varnish4: Fails to build with clang 10; "error:
                    implicit conversion from 'long' to 'double' changes
                    value from 9223372036854775807 to 9223372036854775808"
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: feld@FreeBSD.org
          Reporter: greenreaper@hotmail.com
          Assignee: feld@FreeBSD.org
             Flags: maintainer-feedback?(feld@FreeBSD.org)

Created attachment 212724
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D212724&action=
=3Dedit
Failing portion of compilation log

After installing devel/llvm10 from a port, I tried to recompile our server's
software with it, especially varnish as it recently fell over when we didn't
(it relies on the version of llvm it is compiled with being there on startu=
p,
and we'd removed it).

Unfortunately there is a new error (from a new warning) - basically LONG_MAX
overflows the value that can be precisely represented within a double by ab=
out
11 bits of precision.

The master version has a comment regarding this:
https://raw.githubusercontent.com/varnishcache/varnish-cache/master/lib/lib=
vmod_std/vmod_std_conversions.c
"
 * technically, as our VCL_INT is int64_t, its limits are INT64_MIN/INT64_M=
AX.
 *
 * 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
"

This appears to have been applied in Commit 0f7f757c "sensible limits for
VCL_INT and VCL_BYTES"
https://code.uplex.de/varnishcache/varnish-cache/commit/0f7f757c478351e7a30=
c9820f7542b868743b7b8
but it was later moved purely into vmod_std_conversions.c

varnish 4.1 seems to use LONG_MAX/MIN rather than INT64_MAX/MIN and the only
functions concerned are vmod_real2integer and vmod_time2integer because
vmod_integer concerns an int, not a long, so it doesn't have that check. (T=
his
change was made in
https://varnish-cache.org/lists/pipermail/varnish-commit/2012-October/00918=
0.html
- "Change VCL::INT from C::int to C::long to gain more range on 64bit
architectures.")

I created a patch. Adding this to files/ adjusting the Makefile accordingly:
EXTRA_PATCHES+=3D ${FILESDIR}/fix-long-to-double-rounding.patch
causes compilation to succeed again with clang10.

Don't know if you want to apply it, but varnish 4.1 is still supported, I'm
using it, and in fact there's a new version, 4.1.11, released February 11:
https://github.com/varnishcache/varnish-cache/blob/4.1/doc/changes.rst

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-245075-7788>