projects
/
platform
/
upstream
/
llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
863e812
)
[flang][runtime] Fix NORM2([negative, ...])
author
Peter Klausler
<pklausler@nvidia.com>
Thu, 20 Jul 2023 20:50:10 +0000
(13:50 -0700)
committer
Peter Klausler
<pklausler@nvidia.com>
Fri, 21 Jul 2023 21:57:31 +0000
(14:57 -0700)
NORM2 is broken for arrays that start with a negative number
because it sets the initial running max_ value to that number
rather than to its absolute value.
Differential Revision: https://reviews.llvm.org/D155976
flang/runtime/extrema.cpp
patch
|
blob
|
history
diff --git
a/flang/runtime/extrema.cpp
b/flang/runtime/extrema.cpp
index
c9dcc65
..
d02cf46
100644
(file)
--- a/
flang/runtime/extrema.cpp
+++ b/
flang/runtime/extrema.cpp
@@
-800,7
+800,7
@@
public:
bool Accumulate(Type x) {
auto absX{std::abs(static_cast<AccumType>(x))};
if (!max_) {
- max_ =
x
;
+ max_ =
absX
;
} else if (absX > max_) {
auto t{max_ / absX}; // < 1.0
auto tsq{t * t};