
freebsd 12 x64 gcc 8.3.0 src/core/or/connection_edge.c:2563:5: warning: potential null pointer dereference [-Wnull-dereference] src/lib/math/fp.c:106:16: warning: conversion from 'double' to 'float' may change value [-Wfloat-conversion] src/lib/math/fp.c:111:18: warning: conversion from 'double' to 'float' may change value [-Wfloat-conversion] src/lib/math/fp.c:136:16: warning: conversion from 'double' to 'float' may change value [-Wfloat-conversion] src/lib/math/fp.c:88:13: warning: conversion from 'double' to 'float' may change value [-Wfloat-conversion]

I've got a possible fix for this at https://trac.torproject.org/projects/tor/ticket/31687 , but it needs testing; please let me know if it works for you. As near as I can tell, this code has been unchanged for a while, so I'm surprised if these warnings are new in 0.4.1. Is it possible that a new compiler version or new headers in FreeBSD is what has made them start appearing? (In other words, do you see these warnings if you go back and build 0.4.0 or 0.3.5?) peace, -- Nick

On 9/10/19, Nick Mathewson <nickm@torproject.org> wrote:
https://trac.torproject.org/projects/tor/ticket/31687 needs testing; please let me know if it works for you.
Works. The second hunk for fp.c is below.
Possible, depending on date, gaps in reporting, etc... FreeBSD switched its base from gcc 4.2+ to llvm 3.3 in FreeBSD 10 (2014q1). https://svnweb.freebsd.org/base/stable/12/contrib/gcc/?view=log https://svnweb.freebsd.org/base/stable/12/contrib/llvm/?view=log Users can choose among some compiler toolchain major revs from ports, users default choice of "llvm" / "gcc" has dates in here... https://svnweb.freebsd.org/ports/head/Mk/bsd.default-versions.mk?view=log FreeBSD 12.x default is at llvm 8.0.1, which doesn't complain.
do you see these warnings if you go back and build 0.4.0 or 0.3.5?
Yes to both. ============================================================ --- tor-0.4.1.5/src/lib/math/fp.c.orig 2019-06-10 08:46:16.000000000 -0400 +++ tor-0.4.1.5/src/lib/math/fp.c @@ -123,7 +123,7 @@ tor_isinf(double x) { /* Same as above, work around the "double promotion" warnings */ -#if defined(MINGW_ANY) && GCC_VERSION >= 409 +#if (defined(MINGW_ANY)||defined(__FreeBSD__)) && GCC_VERSION >= 409 #define PROBLEMATIC_FLOAT_CONVERSION_WARNING DISABLE_GCC_WARNING(float-conversion) #endif /* defined(MINGW_ANY) && GCC_VERSION >= 409 */ ============================================================
participants (3)
-
grarpamp
-
Nick Mathewson
-
Nick Mathewson