[PATCH] D128009: [flang] Add semantics test for image_status and add a check

Peter Klausler via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 29 15:18:45 PDT 2022


klausler added inline comments.


================
Comment at: flang/lib/Evaluate/intrinsics.cpp:2347
+      if (auto val{ToInt64(arg->UnwrapExpr())}) {
+        if (val <= 0) {
+          ok = false;
----------------
*val


================
Comment at: flang/lib/Evaluate/intrinsics.cpp:2350
+          context.messages().Say(arg->sourceLocation(),
+              "'image=' argument for intrinsic '%s' must be a positive value"_err_en_US,
+              name);
----------------
Here and in the other two messages: you have the bad value in hand, why not include it in the message?


================
Comment at: flang/lib/Evaluate/intrinsics.cpp:2358
+      if (auto size_val{ToInt64(size_arg->UnwrapExpr())}) {
+        if (size_val <= 0) {
+          ok = false;
----------------
*size_val


================
Comment at: flang/lib/Evaluate/intrinsics.cpp:2365
+          if (auto shift_val{ToInt64(shift_arg->UnwrapExpr())}) {
+            if (std::abs(shift_val.value()) > size_val) {
+              ok = false;
----------------
*shift_val is better


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

https://reviews.llvm.org/D128009



More information about the llvm-commits mailing list