[clang] [analyzer] Fix a test issue in mingw configurations (PR #92737)
https://github.com/mstorsjo closed 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
[clang] [analyzer] Fix a test issue in mingw configurations (PR #92737)
https://github.com/Xazax-hun approved this pull request. 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
[clang] [analyzer] Fix a test issue in mingw configurations (PR #92737)
https://github.com/zmodem approved this pull request. lgtm 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
[clang] [analyzer] Fix a test issue in mingw configurations (PR #92737)
llvmbot wrote: @llvm/pr-subscribers-clang Author: Martin Storsjö (mstorsjo) Changes 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; `` 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
[clang] [analyzer] Fix a test issue in mingw configurations (PR #92737)
https://github.com/mstorsjo created https://github.com/llvm/llvm-project/pull/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. From 392c23804e3531be2786b5ec9712409e222c3dba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Sun, 19 May 2024 00:33:47 +0300 Subject: [PATCH] [analyzer] Fix a test issue in mingw configurations 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. --- clang/unittests/StaticAnalyzer/MemRegionDescriptiveNameTest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits