[Bug analyzer/109570] detect fclose on unopened or NULL files

2023-08-15 Thread glebfm at altlinux dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109570

Gleb Fotengauer-Malinovskiy  changed:

   What|Removed |Added

 CC||glebfm at altlinux dot org

--- Comment #7 from Gleb Fotengauer-Malinovskiy  ---
FYI, the change in the glibc also has an effect on autoconf-based projects,
when the -fanalyzer flag is used in combination with the -Werror flag, see:

https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=ea3e0cec2e66132e34228546256a1657c7b9b2e9

[Bug tree-optimization/110315] [13 Regression] g++ crashes with a segmentation fault while compiling a large const std::vector of std::string since r13-6566-ge0324e2629e25a90

2023-07-29 Thread glebfm at altlinux dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110315

--- Comment #9 from Gleb Fotengauer-Malinovskiy  ---
(In reply to Andrew Macleod from comment #7)
> Created attachment 55591 [details]
> potental patch
> 
> I've attached Aldy's patch for PR109695 which he had backported to GCC13
> back in May.
> This does resolve the issue.. Assuming we want to apply it GCC13.  The
> original variant has been in trunk for a while now.  Im running this thru a
> bootstrap/regression run now.
> 
> I don't know if there is anything further you want to try it with?

We have applied this patch in the ALT Sisyphus gcc13 package and have not
encountered any regressions so far (we do daily test rebuilds of the entire
repository for x86_64 arch).  Additionally, we were able to rebuild the
glaxnimate package with gcc13.

[Bug c++/110315] New: [13 Regression] g++ crashes with a segmentation fault while compiling a large const std::vector of std::string since r13-6566-ge0324e2629e25a90

2023-06-19 Thread glebfm at altlinux dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110315

Bug ID: 110315
   Summary: [13 Regression] g++ crashes with a segmentation fault
while compiling a large const std::vector of
std::string since r13-6566-ge0324e2629e25a90
   Product: gcc
   Version: 13.1.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: glebfm at altlinux dot org
  Target Milestone: ---

Created attachment 55366
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55366=edit
preprocessed source

$ ~/gcc-test/bin/g++ --version
g++ (GCC) 13.1.1 20230619
Copyright (C) 2023 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.

$ ~/gcc-test/bin/g++ -O -c test.ii
g++: internal compiler error: Segmentation fault signal terminated program
cc1plus
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
See  for instructions.

$ gdb -q --args
/usr/src/gcc-test/libexec/gcc/x86_64-pc-linux-gnu/13.1.1/cc1plus -quiet -O
test.cpp -o test.o
Reading symbols from
/usr/src/gcc-test/libexec/gcc/x86_64-pc-linux-gnu/13.1.1/cc1plus...
(gdb) run
Starting program:
/usr/src/gcc-test/libexec/gcc/x86_64-pc-linux-gnu/13.1.1/cc1plus -quiet -O
test.cpp -o test.o
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x01aafe51 in fold_using_range::range_of_phi
(this=this@entry=0x7bfffcaf, r=warning: RTTI symbol not found for class
'int_range<255u>'
..., phi=phi@entry=0x72d4c000, src=...) at
../../gcc/gimple-range-fold.cc:733
733 {
(gdb) bt
#0  0x01aafe51 in fold_using_range::range_of_phi
(this=this@entry=0x7bfffcaf, r=warning: RTTI symbol not found for class
'int_range<255u>'
..., phi=phi@entry=0x72d4c000, src=...)
at ../../gcc/gimple-range-fold.cc:733
#1  0x01ab2289 in fold_using_range::fold_stmt (this=0x7bfffcaf,
r=warning: RTTI symbol not found for class 'int_range<255u>'
..., s=0x72d4c000, src=..., name=0x72d4b480) at
../../gcc/gimple-range-fold.cc:491
#2  0x01aa5292 in gimple_ranger::fold_range_internal
(name=0x72d4b480, s=0x72d4c000, r=warning: RTTI symbol not found for
class 'int_range<255u>'
..., this=0x29069a0) at ../../gcc/gimple-range.cc:257
#3  gimple_ranger::range_of_stmt (this=0x29069a0, r=warning: RTTI symbol not
found for class 'int_range<255u>'
..., s=0x72d4c000, name=) at ../../gcc/gimple-range.cc:318
#4  0x01aa3fbb in gimple_ranger::range_on_entry
(this=this@entry=0x29069a0, r=warning: RTTI symbol not found for class
'int_range<255u>'
..., bb=0x734b0720, name=name@entry=0x72d4b480)
at ../../gcc/gimple-range.cc:153
#5  0x01aa6cff in gimple_ranger::range_of_expr (this=0x29069a0,
r=warning: RTTI symbol not found for class 'int_range<255u>'
..., expr=0x72d4b480, stmt=) at
../../gcc/gimple-range.cc:130
#6  0x01aa418a in gimple_ranger::range_on_exit (this=0x29069a0,
r=warning: RTTI symbol not found for class 'int_range<255u>'
..., bb=0x734b0720, name=0x72d4b480) at ../../gcc/gimple-range.cc:187
#7  0x01aa728a in gimple_ranger::range_on_edge (this=0x29069a0,
r=warning: RTTI symbol not found for class 'int_range<255u>'
..., e=0x7325a720, name=0x72d4b480) at ../../gcc/gimple-range.cc:233
#8  0x01ab012f in fold_using_range::range_of_phi
(this=this@entry=0x7c0073af, r=warning: RTTI symbol not found for class
'int_range<255u>'
..., phi=phi@entry=0x72d4c100, src=...) at ../../gcc/value-range.h:634
#9  0x01ab2289 in fold_using_range::fold_stmt (this=0x7c0073af,
r=warning: RTTI symbol not found for class 'int_range<255u>'
..., s=0x72d4c100, src=..., name=0x72d4b4c8) at
../../gcc/gimple-range-fold.cc:491
#10 0x01aa5292 in gimple_ranger::fold_range_internal
(name=0x72d4b4c8, s=0x72d4c100, r=warning: RTTI symbol not found for
class 'int_range<255u>'
#11 gimple_ranger::range_of_stmt (this=0x29069a0, r=warning: RTTI symbol not
found for class 'int_range<255u>'
..., s=0x72d4c100, name=) at ../../gcc/gimple-range.cc:318
#12 0x01aa3fbb in gimple_ranger::range_on_entry
(this=this@entry=0x29069a0, r=warning: RTTI symbol not found for class
'int_range<255u>'
..., bb=0x734b0900, name=name@entry=0x72d4b4c8)
at ../../gcc/gimple-range.cc:153
#13 0x01aa6cff in gimple_ranger::range_of_expr (this=0x29069a0,
r=warning: RTTI symbol not found for class 'int_range<255u>'
..., expr=0x72d4b4c8, stmt=) at
../../gcc/gimple-range.cc:130
#14 0x01aa418a in gimple_ranger::range_on_exit (this=0x29069a0,
r=warning: RTTI symbol not found for class 'int_range<255u>'
..., 

[Bug analyzer/103602] New: [11 regression] Analyzer takes inadequate amount of memory and time linking GNU grep with LTO

2021-12-07 Thread glebfm at altlinux dot org via Gcc-bugs
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.