[PATCH] D114454: [NFC][AIX]Disable unstable CSA tests failing on AIX

Steven Wan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 23 09:44:42 PST 2021


stevewan created this revision.
stevewan requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

CSA uses bitwidth to infer the integer value type. In the ILP32 model, for example 32-bit AIX, any 32-bit integer type will be
considerred as `int`, which isn't always true. In these particular failed tests, CSA thinks the pointers should be `int`, while in fact they are long on AIX.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D114454

Files:
  clang/unittests/StaticAnalyzer/SValTest.cpp


Index: clang/unittests/StaticAnalyzer/SValTest.cpp
===================================================================
--- clang/unittests/StaticAnalyzer/SValTest.cpp
+++ clang/unittests/StaticAnalyzer/SValTest.cpp
@@ -143,11 +143,19 @@
 //                                 Actual tests
 //===----------------------------------------------------------------------===//
 
+#ifdef _AIX
+SVAL_TEST(DISABLED_GetConstType, R"(
+void foo() {
+  int x = 42;
+  int *y = nullptr;
+})") {
+#else
 SVAL_TEST(GetConstType, R"(
 void foo() {
   int x = 42;
   int *y = nullptr;
 })") {
+#endif
   SVal X = getByName("x");
   ASSERT_FALSE(X.getType(Context).isNull());
   EXPECT_EQ(Context.IntTy, X.getType(Context));
@@ -157,12 +165,21 @@
   EXPECT_EQ(Context.getUIntPtrType(), Y.getType(Context));
 }
 
+#ifdef _AIX
+SVAL_TEST(DISABLED_GetLocAsIntType, R"(
+void foo(int *x) {
+  long int a = (long int)x;
+  unsigned b = (long unsigned)&a;
+  int c = (long int)nullptr;
+})") {
+#else
 SVAL_TEST(GetLocAsIntType, R"(
 void foo(int *x) {
   long int a = (long int)x;
   unsigned b = (long unsigned)&a;
   int c = (long int)nullptr;
 })") {
+#endif
   SVal A = getByName("a");
   ASSERT_FALSE(A.getType(Context).isNull());
   // TODO: Turn it into signed long


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114454.389239.patch
Type: text/x-patch
Size: 1247 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211123/1e339b25/attachment.bin>


More information about the cfe-commits mailing list