forked from OSchip/llvm-project
[flang] NINT(-.4999) is 0, not overflow
Overflow detection in the folding of int/nint/ceiling is incorrectly signalling overflow when a negative argument yields a zero result. Differential Revision: https://reviews.llvm.org/D127785
This commit is contained in:
parent
76782a65ee
commit
2665fbe71e
|
@ -280,8 +280,10 @@ public:
|
|||
if (IsSignBitSet()) {
|
||||
result.value = result.value.Negate().value;
|
||||
}
|
||||
if (IsSignBitSet() != result.value.IsNegative()) {
|
||||
result.flags.set(RealFlag::Overflow);
|
||||
if (!result.value.IsZero()) {
|
||||
if (IsSignBitSet() != result.value.IsNegative()) {
|
||||
result.flags.set(RealFlag::Overflow);
|
||||
}
|
||||
}
|
||||
if (result.flags.test(RealFlag::Overflow)) {
|
||||
result.value =
|
||||
|
|
Loading…
Reference in New Issue