[polly] Fix incorrect pointer checking (PR #117228)

via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 21 12:14:06 PST 2024


https://github.com/ChuvakHome created https://github.com/llvm/llvm-project/pull/117228

Fix for some mistakes in source code found using PVS Studio.

Inspired by: https://pvs-studio.com/en/blog/posts/cpp/1188/

Fixed:
- [Bug 7](https://pvs-studio.com/en/blog/posts/cpp/1188/#ID58D1480040)

>From bfde4b689ab0afe5fec24ad85f1d5e707e791e0b Mon Sep 17 00:00:00 2001
From: timurdemenev <311683 at niuitmo.ru>
Date: Thu, 21 Nov 2024 23:11:26 +0300
Subject: [PATCH] Fix incorrect pointer checking

---
 polly/lib/External/isl/isl_local_space.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/polly/lib/External/isl/isl_local_space.c b/polly/lib/External/isl/isl_local_space.c
index 604e276a0d1f66..1bffcd544eb735 100644
--- a/polly/lib/External/isl/isl_local_space.c
+++ b/polly/lib/External/isl/isl_local_space.c
@@ -254,7 +254,7 @@ isl_size isl_local_space_var_offset(__isl_keep isl_local_space *ls,
 	isl_space *space;
 
 	space = isl_local_space_peek_space(ls);
-	if (space < 0)
+	if (space == NULL)
 		return isl_size_error;
 	switch (type) {
 	case isl_dim_param:



More information about the llvm-commits mailing list