https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103602
Bug ID: 103602 Summary: [11 regression] Analyzer takes inadequate amount of memory and time linking GNU grep with LTO Product: gcc Version: 11.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: analyzer Assignee: dmalcolm at gcc dot gnu.org Reporter: glebfm at altlinux dot org Target Milestone: --- $ gcc --version x86_64-alt-linux-gcc (GCC) 11.2.1 20211202 (ALT Sisyphus 11.2.1-alt2) Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ git clone https://git.savannah.gnu.org/git/grep.git && cd grep && ./bootstrap && CFLAGS='-g -O2 -flto=auto -Wno-error' ./configure && /usr/bin/time make -j`nproc` ... 178.93user 6.85system 2:56.67elapsed 105%CPU (0avgtext+0avgdata 7943640maxresident)k 0inputs+0outputs (0major+2626777minor)pagefaults 0swaps $ cd src && /usr/bin/time gcc -fanalyzer -fno-common -Wall -Warith-conversion -Wbad-function-cast -Wcast-align=strict -Wdate-time -Wdisabled-optimization -Wdouble-promotion -Wduplicated-branches -Wduplicated-cond -Wextra -Wformat-signedness -Winit-self -Winvalid-pch -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wmissing-prototypes -Wnested-externs -Wnull-dereference -Wold-style-definition -Wopenmp-simd -Woverlength-strings -Wpacked -Wpointer-arith -Wshadow -Wstrict-prototypes -Wsuggest-attribute=cold -Wsuggest-attribute=const -Wsuggest-attribute=format -Wsuggest-attribute=malloc -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure -Wsuggest-final-methods -Wsuggest-final-types -Wsync-nand -Wtrampolines -Wuninitialized -Wunknown-pragmas -Wunused-macros -Wvariadic-macros -Wvector-operation-performance -Wvla -Wwrite-strings -Warray-bounds=2 -Wattribute-alias=2 -Wformat-overflow=2 -Wformat=2 -Wformat-truncation=2 -Wimplicit-fallthrough=5 -Wshift-overflow=2 -Wunused-const-variable=2 -Wvla-larger-than=4031 -Wno-analyzer-malloc-leak -Wno-missing-field-initializers -Wno-sign-compare -Wno-unused-parameter -Wno-cast-function-type -Wno-logical-op -Wno-format-nonliteral -Werror -g -O2 -flto=auto -Wno-error -o grep dfasearch.o grep.o kwsearch.o kwset.o searchutils.o ../lib/libgreputils.a ../lib/libgreputils.a ... 175.29user 2.75system 2:56.95elapsed 100%CPU (0avgtext+0avgdata 7934612maxresident)k 0inputs+0outputs (0major+2050508minor)pagefaults 0swaps (with -fno-analyzer flag) $ git clone https://git.savannah.gnu.org/git/grep.git && cd grep && ./bootstrap && CFLAGS='-g -O2 -flto=auto -fno-analyzer -Wno-error' ./configure && /usr/bin/time make -j`nproc` ... 7.53user 5.04system 0:02.66elapsed 471%CPU (0avgtext+0avgdata 65336maxresident)k 0inputs+0outputs (0major+642146minor)pagefaults 0swaps $ cd src && /usr/bin/time gcc -fanalyzer -fno-common -Wall -Warith-conversion -Wbad-function-cast -Wcast-align=strict -Wdate-time -Wdisabled-optimization -Wdouble-promotion -Wduplicated-branches -Wduplicated-cond -Wextra -Wformat-signedness -Winit-self -Winvalid-pch -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wmissing-prototypes -Wnested-externs -Wnull-dereference -Wold-style-definition -Wopenmp-simd -Woverlength-strings -Wpacked -Wpointer-arith -Wshadow -Wstrict-prototypes -Wsuggest-attribute=cold -Wsuggest-attribute=const -Wsuggest-attribute=format -Wsuggest-attribute=malloc -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure -Wsuggest-final-methods -Wsuggest-final-types -Wsync-nand -Wtrampolines -Wuninitialized -Wunknown-pragmas -Wunused-macros -Wvariadic-macros -Wvector-operation-performance -Wvla -Wwrite-strings -Warray-bounds=2 -Wattribute-alias=2 -Wformat-overflow=2 -Wformat=2 -Wformat-truncation=2 -Wimplicit-fallthrough=5 -Wshift-overflow=2 -Wunused-const-variable=2 -Wvla-larger-than=4031 -Wno-analyzer-malloc-leak -Wno-missing-field-initializers -Wno-sign-compare -Wno-unused-parameter -Wno-cast-function-type -Wno-logical-op -Wno-format-nonliteral -Werror -g -O2 -flto=auto -fno-analyzer -Wno-error -o grep dfasearch.o grep.o kwsearch.o kwset.o searchutils.o ../lib/libgreputils.a ../lib/libgreputils.a ... 3.31user 0.13system 0:02.33elapsed 147%CPU (0avgtext+0avgdata 65600maxresident)k 0inputs+0outputs (0major+69122minor)pagefaults 0swaps I bisected this issue to commit r12-1389-g9d20ec97475 (backport r11-8680-gf018044145e in releases/gcc-11 branch), after this change analyzer consumes 3 times more memory (2.5G -> 7.5G) to analyze grep.