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)

enhancement

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.
I am a student from SJCE, Mysore India and would like to take up this bug.
Assignee: nobody → prarthanasjce
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.
Sounds like a good minor reason to bump gcc...if anyone feels bored :)
Product: Core → Firefox Build System
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
P5 because this warning is very noisy and, AFAIU, is a performance problem, not a correctness bug.
Assignee: prarthanasjce → nobody
Priority: -- → P5
I don't think we will ever fix that, closing.
Severity: normal → enhancement
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.