[clang] f31b197 - [analyzer] Fix a test issue in mingw configurations (#92737)
via cfe-commits
cfe-commits at lists.llvm.org
Mon May 27 00:18:07 PDT 2024
Author: Martin Storsjö
Date: 2024-05-27T10:18:03+03:00
New Revision: f31b197d9df141effd439de8be51ce24f3e8f200
URL: https://github.com/llvm/llvm-project/commit/f31b197d9df141effd439de8be51ce24f3e8f200
DIFF: https://github.com/llvm/llvm-project/commit/f31b197d9df141effd439de8be51ce24f3e8f200.diff
LOG: [analyzer] Fix a test issue in mingw configurations (#92737)
On Windows, long is always 32 bit, thus one can't use long for casting
pointers to integers, on 64 bit architectures.
Instead use long long, which should be large enough.
This avoids errors like "error: cast from pointer to smaller type 'long'
loses information" in this testcase.
This condition only seems to be an error in mingw mode; in MSVC mode
(clang-cl), this is only a warning.
Added:
Modified:
clang/unittests/StaticAnalyzer/MemRegionDescriptiveNameTest.cpp
Removed:
################################################################################
diff --git a/clang/unittests/StaticAnalyzer/MemRegionDescriptiveNameTest.cpp b/clang/unittests/StaticAnalyzer/MemRegionDescriptiveNameTest.cpp
index 03aee56a200f6..b13e7123ee524 100644
--- a/clang/unittests/StaticAnalyzer/MemRegionDescriptiveNameTest.cpp
+++ b/clang/unittests/StaticAnalyzer/MemRegionDescriptiveNameTest.cpp
@@ -90,7 +90,7 @@ void reportDescriptiveName(int *p);
extern int* ptr;
extern int array[3];
void top() {
- reportDescriptiveName(&array[(long)ptr]);
+ reportDescriptiveName(&array[(long long)ptr]);
})cpp";
std::string Output;
More information about the cfe-commits
mailing list