Closed
Bug 528206
Opened 15 years ago
Closed 6 years ago
Warn on unnecessary float->double conversion
Categories
(Developer Infrastructure :: Source Code Analysis, enhancement, P5)
Developer Infrastructure
Source Code Analysis
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: jrmuizel, Unassigned)
References
Details
qcms has a bunch of code like:
float p;
...
p *= 65535.;
Since the type of 65535. is a double this code will promote p to a double to do the multiply. This causes the, likely unintended, conversion to double and conversion back to float.
It would be nice if we could warn about situations like this.
Updated•15 years ago
|
Blocks: static_analyses
I am a student from SJCE, Mysore India and would like to take up this bug.
Updated•15 years ago
|
Assignee: nobody → prarthanasjce
![]() |
||
Comment 2•13 years ago
|
||
FWIW, GCC >= 4.6 already has an option to do this (-Wdouble-promotion). The implementation was straightforward; I don't think it would be too hard to port it to clang, if it's not already there.
Comment 3•13 years ago
|
||
Sounds like a good minor reason to bump gcc...if anyone feels bored :)
Updated•7 years ago
|
Product: Core → Firefox Build System
Comment 4•7 years ago
|
||
clang also supports the -Wdouble-promotion warning:
> warning: implicit conversion increases floating-point precision: A to B
https://clang.llvm.org/docs/DiagnosticsReference.html#wdouble-promotion
OS: Mac OS X → Unspecified
Hardware: x86 → Unspecified
Comment 5•7 years ago
|
||
P5 because this warning is very noisy and, AFAIU, is a performance problem, not a correctness bug.
Assignee: prarthanasjce → nobody
Priority: -- → P5
Comment 6•6 years ago
|
||
I don't think we will ever fix that, closing.
Severity: normal → enhancement
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
Updated•3 years ago
|
Product: Firefox Build System → Developer Infrastructure
You need to log in
before you can comment on or make changes to this bug.
Description
•