Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConstantFP::isValueValidForType Broken #781

Closed
llvmbot opened this issue Jul 26, 2004 · 9 comments
Closed

ConstantFP::isValueValidForType Broken #781

llvmbot opened this issue Jul 26, 2004 · 9 comments
Labels
bugzilla Issues migrated from bugzilla code-quality llvm:core wontfix Issue is real, but we can't or won't fix it. Not invalid

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Jul 26, 2004

Bugzilla Link 409
Resolution WONTFIX
Resolved on Feb 22, 2010 12:44
Version 1.0
OS All
Attachments Test case for "float" range
Reporter LLVM Bugzilla Contributor
CC @lattner

Extended Description

This method will happily accept double values for float constants that are
clearly out of range or have precision beyond the acceptable precision of a
float. The current implementation accepts all double values as valid for float.
It shouldn't do that.

Simply casting double -> float -> double and comparing the two doubles doesn't
work well as a test because of rounding errors and/or conversion errors from
decimal notation in AsmParser. Hex conversions work fine as long as the value is
a valid FP double.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Dec 7, 2004

@llvmbot
Copy link
Collaborator Author

llvmbot commented Dec 7, 2004

@llvmbot
Copy link
Collaborator Author

llvmbot commented Dec 7, 2004

Although the patch passed the nightly test and the regression test, it didn't
work on all platforms due to buggy std::numeric_limits<...> implementations. We
tried some math.h things too, but that didn't work. The patch was reverted so
this bug is open until we can find something that works on all platforms.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Dec 9, 2004

Its unclear to me how this should be implemented. What I want to do is make sure
that the range of double values accepted for a FloatTy is within range for the
float type. The cast thing doesn't work, neither does limits checking (because
std::numeric_limits isn't portable or doesn't work everywhere). There are
things in math.h that could be used but they are also unreliable from platform
to plaform so .. what do we do?

I'm thinking along these lines:

float FV = float(V);
double DV = double(FV);

return isinf(V) || isnan(V) || V == DV

Any other ideas?

@lattner
Copy link
Collaborator

lattner commented Dec 9, 2004

That seems reasonable to me. I really have no idea what the right check is.
Putting something in at the start of the 1.5 cycle that tests clean seems
reasonable though.

-Chris

@llvmbot
Copy link
Collaborator Author

llvmbot commented Dec 23, 2005

This is a pernicious little bug. Reopened until a solution can be found that
doesn't cause tests to fail.

@lattner
Copy link
Collaborator

lattner commented Apr 12, 2006

Not happening for 1.7.

I don't think this bug really makes sense. Should we just close it as wontfix?

-Chris

@llvmbot
Copy link
Collaborator Author

llvmbot commented Apr 12, 2006

This bug has been around for a long time, we don't have a better solution than
the current one, and it isn't really affecting anything. So, its WONTFIX'd

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
@Quuxplusone Quuxplusone added the wontfix Issue is real, but we can't or won't fix it. Not invalid label Jan 20, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla code-quality llvm:core wontfix Issue is real, but we can't or won't fix it. Not invalid
Projects
None yet
Development

No branches or pull requests

3 participants