File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed
flang/include/flang/Common Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change 1111
1212#include " Fortran-consts.h"
1313#include " enum-set.h"
14- #include " llvm/Support/MathExtras.h"
1514#include < cstring>
1615
1716// Define a FormatValidator class template to validate a format expression
@@ -215,18 +214,16 @@ template <typename CHAR> void FormatValidator<CHAR>::NextToken() {
215214 case ' 7' :
216215 case ' 8' :
217216 case ' 9' : {
217+ int64_t lastValue;
218218 const CHAR *lastCursor;
219219 integerValue_ = 0 ;
220220 bool overflow{false };
221221 do {
222+ lastValue = integerValue_;
222223 lastCursor = cursor_;
223- if (LLVM_LIKELY (!overflow)) {
224- overflow = llvm::MulOverflow (
225- static_cast <int64_t >(10 ), integerValue_, integerValue_);
226- }
227- if (LLVM_LIKELY (!overflow)) {
228- overflow = llvm::AddOverflow (
229- integerValue_, static_cast <int64_t >(c - ' 0' ), integerValue_);
224+ integerValue_ = 10 * integerValue_ + c - ' 0' ;
225+ if (lastValue > integerValue_) {
226+ overflow = true ;
230227 }
231228 c = NextChar ();
232229 } while (c >= ' 0' && c <= ' 9' );
You can’t perform that action at this time.
0 commit comments