-
Notifications
You must be signed in to change notification settings - Fork 12.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
flang-new 19.0: "warning: overflow on power with INTEGER exponent“ #88151
Comments
@llvm/issue-subscribers-flang-frontend Author: Zaikun ZHANG (zaikunzhang)
Hi,
I am using flang-new 19.0. With the following Fortran code ! test_overflow.f90
program test_overflow
implicit none
print *, range(0.0)
print *, 10.0**(-32.0)
print *, 10.0**(-32)
end program test_overflow I got the following: $ uname -a && flang-new --version && flang-new test_overflow.f90 && ./a.out
Linux 6.5.0-26-generic #<!-- -->26~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Mar 12 10:22:43 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
flang-new version 19.0.0git (git@<!-- -->github.com:llvm/llvm-project.git 37c175af955f0aeab67e8c553a0a47b2ed0fdba2)
Target: x86_64-unknown-linux-gnu
Thread model: posix
./test_overflow.f90:6:10: warning: overflow on power with INTEGER exponent
print *, 10.0**(-32)
^^^^^^^^^^^
37
1.E-32
9.9999995E-33 Note that What is overflowing? Is this expected or a false positive? Thanks. |
It's a bogus warning and you can ignore it. Will fix. |
…er powers The code that folds exponentiation by an integer power can report a spurious overflow warning because it calculates one last unnecessary square of the base value. 10.**(+/-32) exposes the problem -- the value of 10.**64 is calculated but not needed. Rearrange the implementation to only calculate squares that are necessary. Fixes llvm#88151.
Fixed by #88188. |
@klausler Great! Thank you for the very prompt fix. Indeed, I spotted this bug by trying
with |
#88188) …er powers The code that folds exponentiation by an integer power can report a spurious overflow warning because it calculates one last unnecessary square of the base value. 10.**(+/-32) exposes the problem -- the value of 10.**64 is calculated but not needed. Rearrange the implementation to only calculate squares that are necessary. Fixes #88151.
Hi,
I am using flang-new 19.0. With the following Fortran code
I got the following:
Note that
print *, 10.0**(-32)
leads to an "overflow on power with INTEGER exponent".What is overflowing? Is this expected or a false positive?
Thanks.
The text was updated successfully, but these errors were encountered: