Skip to content

Commit f31b197

Browse files
authored
[analyzer] Fix a test issue in mingw configurations (llvm#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.
1 parent 80b78f5 commit f31b197

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clang/unittests/StaticAnalyzer/MemRegionDescriptiveNameTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ void reportDescriptiveName(int *p);
9090
extern int* ptr;
9191
extern int array[3];
9292
void top() {
93-
reportDescriptiveName(&array[(long)ptr]);
93+
reportDescriptiveName(&array[(long long)ptr]);
9494
})cpp";
9595

9696
std::string Output;

0 commit comments

Comments
 (0)