[clang] [analyzer] Remove some false negatives in StackAddrEscapeChecker (PR #125638)

LLVM Continuous Integration via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 10 14:22:27 PST 2025


llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `amdgpu-offload-ubuntu-22-cmake-build-only` running on `rocm-docker-ubu-22` while building `clang` at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/203/builds/1621

<details>
<summary>Here is the relevant piece of the build log for the reference</summary>

```
Step 4 (annotate) failure: '../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py --jobs=32' (failure)
...
[6643/7633] Linking CXX executable bin/llvm-exegesis
[6644/7633] Building AMDGPUGenInstrInfo.inc...
[6645/7633] Building AMDGPUGenRegisterInfo.inc...
[6646/7633] Linking CXX shared library lib/libFortranParser.so.21.0git
[6647/7633] Creating library symlink lib/libFortranParser.so
[6648/7633] Linking CXX executable bin/f18-parse-demo
[6649/7633] Building AMDGPUGenRegisterBank.inc...
[6650/7633] Linking CXX shared library lib/libFortranEvaluate.so.21.0git
[6651/7633] Creating library symlink lib/libFortranEvaluate.so
[6652/7633] Building CXX object tools/clang/lib/StaticAnalyzer/Checkers/CMakeFiles/obj.clangStaticAnalyzerCheckers.dir/StackAddrEscapeChecker.cpp.o
FAILED: tools/clang/lib/StaticAnalyzer/Checkers/CMakeFiles/obj.clangStaticAnalyzerCheckers.dir/StackAddrEscapeChecker.cpp.o 
ccache /usr/bin/c++ -DCLANG_EXPORTS -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/tools/clang/lib/StaticAnalyzer/Checkers -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/lib/StaticAnalyzer/Checkers -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/tools/clang/include -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/include -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/clang/lib/StaticAnalyzer/Checkers/CMakeFiles/obj.clangStaticAnalyzerCheckers.dir/StackAddrEscapeChecker.cpp.o -MF tools/clang/lib/StaticAnalyzer/Checkers/CMakeFiles/obj.clangStaticAnalyzerCheckers.dir/StackAddrEscapeChecker.cpp.o.d -o tools/clang/lib/StaticAnalyzer/Checkers/CMakeFiles/obj.clangStaticAnalyzerCheckers.dir/StackAddrEscapeChecker.cpp.o -c /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp:252:28: error: declaration of ‘const clang::StackFrameContext* FindStackRegionsSymbolVisitor::StackFrameContext’ changes meaning of ‘StackFrameContext’ [-fpermissive]
  252 |   const StackFrameContext *StackFrameContext;
      |                            ^~~~~~~~~~~~~~~~~
In file included from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/Analysis/ProgramPoint.h:17,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/StaticAnalyzer/Core/Checker.h:16,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h:18,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp:17:
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/Analysis/AnalysisDeclContext.h:299:7: note: ‘StackFrameContext’ declared here as ‘class clang::StackFrameContext’
  299 | class StackFrameContext : public LocationContext {
      |       ^~~~~~~~~~~~~~~~~
[6653/7633] Linking CXX shared library lib/libFortranSemantics.so.21.0git
[6654/7633] Building InstCombineTables.inc...
ninja: build stopped: subcommand failed.
['ninja'] exited with return code 1.
The build step threw an exception...
Traceback (most recent call last):
  File "/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 45, in step
    yield
  File "/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 36, in main
    run_command(["ninja"])
  File "/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 58, in run_command
    util.report_run_cmd(cmd, cwd=directory)
  File "/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-zorg/zorg/buildbot/builders/annotated/util.py", line 49, in report_run_cmd
    subprocess.check_call(cmd, shell=shell, *args, **kwargs)
  File "/usr/lib/python3.10/subprocess.py", line 369, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ninja']' returned non-zero exit status 1.
@@@STEP_FAILURE@@@
Step 7 (build cmake config) failure: build cmake config (failure)
...
[6643/7633] Linking CXX executable bin/llvm-exegesis
[6644/7633] Building AMDGPUGenInstrInfo.inc...
[6645/7633] Building AMDGPUGenRegisterInfo.inc...
[6646/7633] Linking CXX shared library lib/libFortranParser.so.21.0git
[6647/7633] Creating library symlink lib/libFortranParser.so
[6648/7633] Linking CXX executable bin/f18-parse-demo
[6649/7633] Building AMDGPUGenRegisterBank.inc...
[6650/7633] Linking CXX shared library lib/libFortranEvaluate.so.21.0git
[6651/7633] Creating library symlink lib/libFortranEvaluate.so
[6652/7633] Building CXX object tools/clang/lib/StaticAnalyzer/Checkers/CMakeFiles/obj.clangStaticAnalyzerCheckers.dir/StackAddrEscapeChecker.cpp.o
FAILED: tools/clang/lib/StaticAnalyzer/Checkers/CMakeFiles/obj.clangStaticAnalyzerCheckers.dir/StackAddrEscapeChecker.cpp.o 
ccache /usr/bin/c++ -DCLANG_EXPORTS -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/tools/clang/lib/StaticAnalyzer/Checkers -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/lib/StaticAnalyzer/Checkers -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/tools/clang/include -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/include -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/clang/lib/StaticAnalyzer/Checkers/CMakeFiles/obj.clangStaticAnalyzerCheckers.dir/StackAddrEscapeChecker.cpp.o -MF tools/clang/lib/StaticAnalyzer/Checkers/CMakeFiles/obj.clangStaticAnalyzerCheckers.dir/StackAddrEscapeChecker.cpp.o.d -o tools/clang/lib/StaticAnalyzer/Checkers/CMakeFiles/obj.clangStaticAnalyzerCheckers.dir/StackAddrEscapeChecker.cpp.o -c /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp:252:28: error: declaration of ‘const clang::StackFrameContext* FindStackRegionsSymbolVisitor::StackFrameContext’ changes meaning of ‘StackFrameContext’ [-fpermissive]
  252 |   const StackFrameContext *StackFrameContext;
      |                            ^~~~~~~~~~~~~~~~~
In file included from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/Analysis/ProgramPoint.h:17,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/StaticAnalyzer/Core/Checker.h:16,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h:18,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp:17:
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/Analysis/AnalysisDeclContext.h:299:7: note: ‘StackFrameContext’ declared here as ‘class clang::StackFrameContext’
  299 | class StackFrameContext : public LocationContext {
      |       ^~~~~~~~~~~~~~~~~
[6653/7633] Linking CXX shared library lib/libFortranSemantics.so.21.0git
[6654/7633] Building InstCombineTables.inc...
ninja: build stopped: subcommand failed.
['ninja'] exited with return code 1.
The build step threw an exception...
Traceback (most recent call last):
  File "/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 45, in step
    yield
  File "/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 36, in main
    run_command(["ninja"])
  File "/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 58, in run_command
    util.report_run_cmd(cmd, cwd=directory)
  File "/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-zorg/zorg/buildbot/builders/annotated/util.py", line 49, in report_run_cmd
    subprocess.check_call(cmd, shell=shell, *args, **kwargs)
  File "/usr/lib/python3.10/subprocess.py", line 369, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ninja']' returned non-zero exit status 1.
program finished with exit code 0
elapsedTime=51.394743

```

</details>

https://github.com/llvm/llvm-project/pull/125638


More information about the cfe-commits mailing list