[flang-commits] [flang] 3867403 - Apply fix from D81179 only from GCC < 8
Valentin Clement via flang-commits
flang-commits at lists.llvm.org
Mon Jun 8 12:52:06 PDT 2020
Author: Valentin Clement
Date: 2020-06-08T15:51:57-04:00
New Revision: 38674030c026b6ba432dc81440bd3790d94b7c48
URL: https://github.com/llvm/llvm-project/commit/38674030c026b6ba432dc81440bd3790d94b7c48
DIFF: https://github.com/llvm/llvm-project/commit/38674030c026b6ba432dc81440bd3790d94b7c48.diff
LOG: Apply fix from D81179 only from GCC < 8
Summary: Apply workaround done in D81179 only for GCC < 8. As @klausler mentioned in D81179 we want to avoid additional checks for other compilers that do not need them.
Reviewers: DavidTruby, klausler, jdoerfert, sscalpone
Reviewed By: klausler, sscalpone
Subscribers: llvm-commits, tskeith, isuruf, klausler
Tags: #flang, #llvm
Differential Revision: https://reviews.llvm.org/D81208
Added:
Modified:
flang/include/flang/Evaluate/integer.h
flang/lib/Decimal/big-radix-floating-point.h
Removed:
################################################################################
diff --git a/flang/include/flang/Evaluate/integer.h b/flang/include/flang/Evaluate/integer.h
index ecefbc45b2cd..6b91cb250c98 100644
--- a/flang/include/flang/Evaluate/integer.h
+++ b/flang/include/flang/Evaluate/integer.h
@@ -805,9 +805,13 @@ class Integer {
if (Part ypart{y.LEPart(k)}) {
BigPart xy{xpart};
xy *= ypart;
- // && to < (2 * parts) was added to avoid GCC < 8 build failure
- // on -Werror=array-bounds
- for (int to{ j + k }; xy != 0 && to < (2 * parts); ++to) {
+#if defined __GNUC__ && __GNUC__ < 8
+ // && to < (2 * parts) was added to avoid GCC < 8 build failure on
+ // -Werror=array-bounds. This can be removed if -Werror is disable.
+ for (int to{j + k}; xy != 0 && to < (2 * parts); ++to) {
+#else
+ for (int to{j + k}; xy != 0; ++to) {
+#endif
xy += product[to];
product[to] = xy & partMask;
xy >>= partBits;
diff --git a/flang/lib/Decimal/big-radix-floating-point.h b/flang/lib/Decimal/big-radix-floating-point.h
index 67f0b46ab213..18626e2b55df 100644
--- a/flang/lib/Decimal/big-radix-floating-point.h
+++ b/flang/lib/Decimal/big-radix-floating-point.h
@@ -179,10 +179,13 @@ template <int PREC, int LOG10RADIX = 16> class BigRadixFloatingPointNumber {
if (remove >= digits_) {
digits_ = 0;
} else if (remove > 0) {
+#if defined __GNUC__ && __GNUC__ < 8
// (&& j + remove < maxDigits) was added to avoid GCC < 8 build failure
- // on -Werror=array-bounds
- for (int j{ 0 }; j + remove < digits_ && (j + remove < maxDigits);
- ++j) {
+ // on -Werror=array-bounds. This can be removed if -Werror is disable.
+ for (int j{0}; j + remove < digits_ && (j + remove < maxDigits); ++j) {
+#else
+ for (int j{0}; j + remove < digits_; ++j) {
+#endif
digit_[j] = digit_[j + remove];
}
digits_ -= remove;
More information about the flang-commits
mailing list