llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Martin Storsjö (mstorsjo)

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/92737.diff


1 Files Affected:

- (modified) clang/unittests/StaticAnalyzer/MemRegionDescriptiveNameTest.cpp 
(+1-1) 


``````````diff
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;

``````````

</details>


https://github.com/llvm/llvm-project/pull/92737
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to