-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Closed
Labels
flang:frontendquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!
Description
Consider the following reducer
PROGRAM main
IMPLICIT NONE
INTEGER(1), PARAMETER :: I1Max=127
INTEGER(2), PARAMETER :: I2Max=32767
print*, I2Max+I1Max-1
END
Flang complains:
./t.f:8:12: warning: INTEGER(2) addition overflowed [-Wfolding-exception]
print*, (I2Max+I1Max-1)
^^^^^^^^^^^
The result integer kind of the expression should be default integer kind, which is 4.
The error message seems incorrect, which also caused incorrect run result.
Metadata
Metadata
Assignees
Labels
flang:frontendquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!