[flang-commits] [flang] Fix compilation warning (PR #99328)

Pete Steinfeld via flang-commits flang-commits at lists.llvm.org
Wed Jul 17 06:45:53 PDT 2024


https://github.com/psteinfeld created https://github.com/llvm/llvm-project/pull/99328

With change #98881, I was getting a warning that an expression needed more parentheses.

Note that I build with GCC 9.3.0.

>From 9d4582f21dcae3063cb716d1ca25b66ab89e4c02 Mon Sep 17 00:00:00 2001
From: Peter Steinfeld <psteinfeld at nvidia.com>
Date: Wed, 17 Jul 2024 06:04:48 -0700
Subject: [PATCH 1/2] With change #98881, I was getting a warning about an
 expression that parentheses were needed around an expression.

I'm building with GCC 9.3.0.
---
 flang/lib/Optimizer/Builder/IntrinsicCall.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/flang/lib/Optimizer/Builder/IntrinsicCall.cpp b/flang/lib/Optimizer/Builder/IntrinsicCall.cpp
index e12e21bb00e15..fca39e8023605 100644
--- a/flang/lib/Optimizer/Builder/IntrinsicCall.cpp
+++ b/flang/lib/Optimizer/Builder/IntrinsicCall.cpp
@@ -6148,7 +6148,7 @@ IntrinsicLibrary::genScan(mlir::Type resultType,
 fir::ExtendedValue
 IntrinsicLibrary::genSecond(std::optional<mlir::Type> resultType,
                             mlir::ArrayRef<fir::ExtendedValue> args) {
-  assert(args.size() == 1 && !resultType || args.empty() && resultType);
+  assert((args.size() == 1 && !resultType) || args.empty() && resultType);
 
   fir::ExtendedValue result;
 

>From d3d563c07d312f24e104af217e45fd3e2e555817 Mon Sep 17 00:00:00 2001
From: Peter Steinfeld <psteinfeld at nvidia.com>
Date: Wed, 17 Jul 2024 06:04:48 -0700
Subject: [PATCH 2/2] With change #98881, I was getting a warning about an
 expression that parentheses were needed around an expression.

I'm building with GCC 9.3.0.
---
 flang/lib/Optimizer/Builder/IntrinsicCall.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/flang/lib/Optimizer/Builder/IntrinsicCall.cpp b/flang/lib/Optimizer/Builder/IntrinsicCall.cpp
index fca39e8023605..ba71fb3b4040c 100644
--- a/flang/lib/Optimizer/Builder/IntrinsicCall.cpp
+++ b/flang/lib/Optimizer/Builder/IntrinsicCall.cpp
@@ -6148,7 +6148,7 @@ IntrinsicLibrary::genScan(mlir::Type resultType,
 fir::ExtendedValue
 IntrinsicLibrary::genSecond(std::optional<mlir::Type> resultType,
                             mlir::ArrayRef<fir::ExtendedValue> args) {
-  assert((args.size() == 1 && !resultType) || args.empty() && resultType);
+  assert((args.size() == 1 && !resultType) || (args.empty() && resultType));
 
   fir::ExtendedValue result;
 



More information about the flang-commits mailing list