Using BENCHMARK() on Windows 10 system causes SIGSEGV depending on compiler
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- cmake, cpp
- Área
- performance, testing
Línea de trabajo
Comienza reproduciendo el fallo con main.cpp, Benchmark.cpp y CMakeLists.txt en las dos versiones de MSVC indicadas, utilizando los comandos de CMake proporcionados. Compara la ruta de BENCHMARK() con el resultado del compilador que funciona y verifica que el ejecutable finaliza sin SIGSEGV, mientras REQUIRE() permanece sin cambios.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
Calling application that uses BENCHMARK() compiled with current MSVC compiler causes program to fail with SIGSEGV on a Windows 10 system. Using an older compiler works.
Expected behavior
When .exe file is called, the benchmark should complete without aborting.
Reproduction steps
Complete minimum viable example:
main.cpp:
#include <catch2/catch_session.hpp>
int main(int argc,char* argv[])
{
return Catch::Session().run(argc, argv);
}
Benchmark.cpp:
#include <catch2/catch_test_macros.hpp>
#include <catch2/benchmark/catch_benchmark.hpp>
int stub()
{
return 0;
}
TEST_CASE("Main") {
BENCHMARK("main") {
return stub();
};
}
CMakeLists.txt:
cmake_minimum_required (VERSION 3.20)
project ("Benchmark" LANGUAGES CXX)
find_package(Catch2 3 REQUIRED)
include(CTest)
include(Catch)
set(benchmark_src "Benchmark.cpp" "main.cpp")
add_executable(benchmark ${benchmark_src})
target_link_libraries(benchmark PRIVATE Catch2::Catch2)
set_property(TARGET benchmark PROPERTY CXX_STANDARD 20)
catch_discover_tests(benchmark)
Code generation for version with bug, started from Development PowerShell for VS 2022:
cmake -DCMAKE_PREFIX_PATH=[...]\Catch2Release -B build -S . -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build .\build\
Code generation for version without bug, started from clean command prompt:
"[...]\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x64 -vcvars_ver=14.29
cmake -DCMAKE_PREFIX_PATH=[...]\Catch2ReleaseOldCompiler -B build -S . -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build .\build\
Output:
-------------------------------------------------------------------------------
Main
-------------------------------------------------------------------------------
[...]\Benchmark.cpp(9)
...............................................................................
benchmark name samples iterations est run time
mean low mean high mean
std dev low std dev high std dev
-------------------------------------------------------------------------------
main 100 45739 0 ns
[...]\Benchmark.cpp(9[...]\Benchmark.cpp[...]\Benchmark.cpp)(: 9()9: )FAILEDFAILED:
:
: due to a fatal error conditiondue to a fatal error condition:FAILED:
:
due to a fatal error condition SIGSEGV - Segmentation violation signal: SIGSEGV - Segmentation violation signal
===============================================================================
SIGSEGV - Segmentation violation signal===============================================================================
------
---test cases-: -
1- | test cases-1----: --2failed---- |
-2assertions---- : -failed---3--
-assertions- | -: ---3 3-- | -failed3-----
failed
--
-
----------------------------
Platform information:
Target system:
- OS: Microsoft Windows 10 Enterprise LTSC, Version 10.0.17763 Build 17763
General build configuration:
- OS: Windows 11 Pro, Version 10.0.22.631 Build 22631
- Catch version: v3.8.1 devel version at commit 04cbcfa1 (11.06.2025)**
- CMake version: 4.0.3
Build configuration with bug:
- Compiler+version: MSVC 19.44.35211.0 (current version for Visual Studio 2022 as of right now)
Build system configuration without bug:
- Compiler+version: MSVC 19.29.30159.0 (last version for Visual Studio 2019)
Additional context
- I built the Catch2 libraries from the source files with the compiler versions listed above.
- Both versions run on the build system.
- Using other Catch2 features such as REQUIRE() instead of BENCHMARK() does not produce any errors.
- Lenguaje dominante
- C++
- Estrellas
- 21.6k
- Forks
- 3.4k
- Merge medio
- 3 d 12 h
- PR fusionados (30 d)
- 5
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de catchorg/Catch2
-
catch_discover_tests fails for Windows test executables run under Wine since v3.15.2Posiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
Los mantenedores suelen responder en 2 días
-
catch_discover_tests passes all EXTRA_ARGS as one argumentPosiblemente ocupada @CyberKun la tomó hace 11 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
catchorg/Catch2#3239 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
Not seeing some error messages from fakeit in jetbrains riderPosiblemente ocupada @Amanpal9 la tomó hace 21 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
catchorg/Catch2#3228 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
catch_discover_tests fails for Emscripten/WASM tests since v3.16.0Posiblemente ocupada @nafiurahman00 la tomó hace 8 días. AbiertoExtras
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
catchorg/Catch2#3241 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
Los mantenedores suelen responder en 2 días
Todos los issues de catchorg/Catch2
Issues similares
-
Build fails on macOS 27: dyld refuses stripped Rust proc-macros (mis-aligned LINKEDIT string pool)Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
cloudflare/workerd#8963 ·
Los mantenedores suelen responder en 1 día
-
Android Bug Core Drape
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
organicmaps/organicmaps#14449 ·
Los mantenedores suelen responder en 1 día
-
comp-codecs
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
ClickHouse/ClickHouse#135159 ·
Los mantenedores suelen responder en 1 día
-
difficulty:easy func:python os:windows prio:high type:bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
NatronGitHub/Natron#2029 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
ardazishvili/Sota#114 ·
Los mantenedores suelen responder en 1 día