https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112981
Bug ID: 112981
Summary: [13/14 Regression] Big compile time and run time
regression in libasan with
g:f732bf6a603721f61102a08ad2d023c7c2670870
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Keywords: compile-time-hog
Severity: normal
Priority: P3
Component: sanitizer
Assignee: unassigned at gcc dot gnu.org
Reporter: tnfchris at gcc dot gnu.org
CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at
gcc dot gnu.org
Target Milestone: ---
Target: aarch64-*
Starting with the sync with upstream in
g:f732bf6a603721f61102a08ad2d023c7c2670870
f732bf6a603721f61102a08ad2d023c7c2670870 is the first bad commit
commit f732bf6a603721f61102a08ad2d023c7c2670870
Author: Martin Liska <[email protected]>
Date: Tue May 3 12:56:26 2022 +0200
libsanitizer: merge from upstream
(0a1bcab9f3bf75c4c5d3e53bafb3eeb80320af46).
there's a massive compile time and performance overhead (6x slower) when using
-fsanitize=address.
The following testcase (due to the dependencies provided as cmake project)
illustrates this:
-- main.cpp:
#include <catch2/generators/catch_generators.hpp>
#include <catch2/catch_test_macros.hpp>
TEST_CASE("Test") {
for (int i= 0; i<1000000; i++) {
REQUIRE(1 + 2 == 3);
}
}
-- CMakeList.txt
cmake_minimum_required(VERSION 3.5)
project(slow_asan)
add_compile_options(-fsanitize=address)
add_link_options(-fsanitize=address)
Include(FetchContent)
FetchContent_Declare(
Catch2
SYSTEM
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v3.3.0
)
FetchContent_MakeAvailable(Catch2)
add_executable(tests main.cpp)
target_link_libraries(tests PRIVATE Catch2::Catch2WithMain)
--- command
cmake -DCMAKE_C_COMPILER=${install_dir}/bin/gcc
-DCMAKE_CXX_COMPILER=${install_dir}/bin/g++ -DCMAKE_BUILD_TYPE=Release . &&
make VERBOSE=1 -j && timeout 10.0s ./tests
will take significantly longer than in GCC 12 (compiles at -O3).
I have not yet tracked down if the compile hog is a GCC issue or not.