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
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;
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;