[flang-commits] [PATCH] D136974: [flang] Emit warnings when results of folding some integer intrinsics overflow

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Fri Oct 28 14:21:43 PDT 2022


klausler added a comment.

folding05.f90 is not actually a binary file, but it does contain a NUL character that makes "diff" think that it is one.  The diff on the file is:

  diff --git a/flang/test/Evaluate/folding05.f90 b/flang/test/Evaluate/folding05.f90
  index 3be3904ccab5..f876a56691b8 100644
  --- a/flang/test/Evaluate/folding05.f90
  +++ b/flang/test/Evaluate/folding05.f90
  @@ -33,12 +33,14 @@ module character_intrinsic_tests
  
     logical, parameter :: test_ichar1 = char(ichar("a")).EQ."a"
     logical, parameter :: test_ichar2 = ichar(char(255)).EQ.255
  +  !WARN: warning: Result of intrinsic function 'ichar' (255) overflows its result type
     logical, parameter :: test_ichar3 = ichar(char(-1_1), 1).EQ.-1_1
     logical, parameter :: test_ichar4 = ichar(char(2147483647_4, 4), 4).EQ.2147483647_4
     logical, parameter :: test_ichar5 = ichar(char(4294967295_8, 4), 8).EQ.4294967295_8
     logical, parameter :: test_ichar6 = ichar(char(4294967296_8, 4), 8).EQ.0_8
     logical, parameter :: test_iachar1 = achar(iachar("a")).EQ."a"
     logical, parameter :: test_iachar2 = iachar(achar(22)).EQ.22
  +  !WARN: warning: Result of intrinsic function 'ichar' (2147483649) overflows its result type
     logical, parameter :: test_iachar3 = ichar(char(-2147483647_4, 4), 4).EQ.(-2147483647_4)
     logical, parameter :: test_iachar5 = ichar(char(65535_4, 2), 4).EQ.65535_4
     logical, parameter :: test_iachar6 = ichar(char(65536_4, 2), 4).EQ.0_4


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136974/new/

https://reviews.llvm.org/D136974



More information about the flang-commits mailing list