Opened 4 months ago
Closed 4 months ago
#22915 closed defect (fixed)
clang 4.0 double promotion warnings in clamp_double_to_int64()
Reported by: | nickm | Owned by: | nickm |
---|---|---|---|
Priority: | Medium | Milestone: | Tor: 0.3.2.x-final |
Component: | Core Tor/Tor | Version: | |
Severity: | Normal | Keywords: | 029-backport, 030-backport, 031-backport, review-group-21 |
Cc: | Actual Points: | ||
Parent ID: | Points: | .1 | |
Reviewer: | ahf | Sponsor: |
Description
Just upgraded to clang 4.0, and I'm seeing this:
CC src/common/util.o src/common/util.c:5612:13: error: implicit conversion increases floating-point precision: 'double' to 'long double' [-Werror,-Wdouble-promotion] if (isnan(number)) { ~~~~~~^~~~~~~ /usr/include/math.h:385:46: note: expanded from macro 'isnan' # define isnan(x) __MATH_TG ((x), __isnan, (x)) ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/math.h:320:16: note: expanded from macro '__MATH_TG' : FUNC ## l ARGS) ~~~~~~~~~ ^~~~ src/common/util.c:5630:16: error: implicit conversion increases floating-point precision: 'double' to 'long double' [-Werror,-Wdouble-promotion] if (isfinite(number) && exponent <= 63) { ~~~~~~~~~^~~~~~~ /usr/include/math.h:370:50: note: expanded from macro 'isfinite' # define isfinite(x) __MATH_TG ((x), __finite, (x)) ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/math.h:320:16: note: expanded from macro '__MATH_TG' : FUNC ## l ARGS) ~~~~~~~~~ ^~~~ src/common/util.c:5635:18: error: implicit conversion increases floating-point precision: 'double' to 'long double' [-Werror,-Wdouble-promotion] return signbit(number) ? INT64_MIN : INT64_MAX; ~~~~~~~~^~~~~~~ /usr/include/math.h:361:58: note: expanded from macro 'signbit' # define signbit(x) __MATH_TG ((x), __builtin_signbit, (x)) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/math.h:320:16: note: expanded from macro '__MATH_TG' : FUNC ## l ARGS) ~~~~~~~~~ ^~~~ 3 errors generated.
Child Tickets
Change History (9)
comment:1 follow-up: 4 Changed 4 months ago by
comment:2 Changed 4 months ago by
Points: | → .1 |
---|---|
Status: | new → needs_review |
Please review branch bug22915_029
comment:3 Changed 4 months ago by
Component: | - Select a component → Core Tor/Tor |
---|
The "Tor" component will greatly help :D.
comment:4 Changed 4 months ago by
comment:5 Changed 4 months ago by
Keywords: | review-group-21 added |
---|
comment:7 Changed 4 months ago by
Status: | accepted → needs_review |
---|
comment:8 Changed 4 months ago by
Reviewer: | → ahf |
---|---|
Status: | needs_review → merge_ready |
Minor typo in a comment:
since clang things we're promoting a double to a long double.
should be:
since clang thinks we're promoting a double to a long double.
comment:9 Changed 4 months ago by
Resolution: | → fixed |
---|---|
Status: | merge_ready → closed |
Fixed and merged; thanks!
Note: See
TracTickets for help on using
tickets.
(Ignore deleted comment; it was wrong.)
This is related to, but not the same as, #22081.