[Bug testsuite/96609] new test case gcc.dg/analyzer/init.c has many failures

2020-08-14 Thread dmalcolm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96609

David Malcolm  changed:

   What|Removed |Added

 Resolution|--- |DUPLICATE
 Status|UNCONFIRMED |RESOLVED

--- Comment #3 from David Malcolm  ---
Thanks for filing this.

r11-2708-g2867118ddda9b56d991c16022f7d3d634ed08313 should fix the init.c issue
mentioned in this bug's title, but not the issue in comment #1.

Both issues here are also being tracked by PR analyzer/96616 which has a more
generic title, so I'm going to close out this bug as a duplicate of that one.

*** This bug has been marked as a duplicate of bug 96616 ***

[Bug testsuite/96609] new test case gcc.dg/analyzer/init.c has many failures

2020-08-14 Thread cvs-commit at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96609

--- Comment #2 from CVS Commits  ---
The master branch has been updated by David Malcolm :

https://gcc.gnu.org/g:2867118ddda9b56d991c16022f7d3d634ed08313

commit r11-2708-g2867118ddda9b56d991c16022f7d3d634ed08313
Author: David Malcolm 
Date:   Fri Aug 14 15:49:52 2020 -0400

analyzer: fix initialization from constant pool [PR96609,PR96616]

PR testsuite/96609 and PR analyzer/96616 report various testsuite
failures seen on powerpc64, aarch64, and arm in new tests added by
r11-2694-g808f4dfeb3a95f50f15e71148e5c1067f90a126d.

Some of these failures (in gcc.dg/analyzer/init.c, and on arm
in gcc.dg/analyzer/casts-1.c) relate to initializations from var_decls
in the constant pool.  I wrote the tests assuming that the gimplified
stmts would initialize the locals via a gassign of code CONSTRUCTOR,
whereas on these targets some of the initializations are gassign from
a VAR_DECL e.g.:
  c = *.LC0;
where "*.LC0" is a var_decl with DECL_IN_CONSTANT_POOL set.

For example, in test_7:
   struct coord c[2] = {{3, 4}, {5, 6}};
   __analyzer_eval (c[0].x == 3); /* { dg-warning "TRUE" } */
after the initialization, the store was simply recording:
   cluster for: c: INIT_VAL(*.LC0)
when I was expecting the cluster for c to have:
  cluster for: c
key:   {kind: direct, start: 0, size: 32, next: 32}
value: 'int' {(int)3}
key:   {kind: direct, start: 32, size: 32, next: 64}
value: 'int' {(int)4}
key:   {kind: direct, start: 64, size: 32, next: 96}
value: 'int' {(int)5}
key:   {kind: direct, start: 96, size: 32, next: 128}
value: 'int' {(int)6}
The test for c[0].x == 3 would then generate:
  cluster for: _2: (SUB(SUB(INIT_VAL(*.LC0), c[(int)0]),
c[(int)0].x)==(int)3)
which is UNKNOWN, leading to the test failing.

This patch fixes the init.c and casts-1.c failures by special-casing
reads from a var_decl with DECL_IN_CONSTANT_POOL set, so that they build
a compound_svalue containing the bindings implied by the CONSTRUCTOR
node for DECL_INITIAL.

gcc/analyzer/ChangeLog:
PR testsuite/96609
PR analyzer/96616
* region-model.cc (region_model::get_store_value): Call
maybe_get_constant_value on decl_regions first.
* region-model.h (decl_region::maybe_get_constant_value): New decl.
* region.cc (decl_region::get_stack_depth): Likewise.
(decl_region::maybe_get_constant_value): New.
* store.cc (get_subregion_within_ctor): New.
(binding_map::apply_ctor_to_region): New.
* store.h (binding_map::apply_ctor_to_region): New decl.

[Bug testsuite/96609] new test case gcc.dg/analyzer/init.c has many failures

2020-08-13 Thread seurer at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96609

seurer at gcc dot gnu.org changed:

   What|Removed |Added

   Host||powerpc64*-linux-gnu
 Target||powerpc64*-linux-gnu
  Build||powerpc64*-linux-gnu
 CC||bergner at gcc dot gnu.org,
   ||dmalcolm at gcc dot gnu.org

--- Comment #1 from seurer at gcc dot gnu.org ---
Also these:

Executing on host: /home/seurer/gcc/git/build/gcc-test/gcc/xgcc
-B/home/seurer/gcc/git/build/gcc-test/gcc/
/home/seurer/gcc/git/gcc-test/gcc/testsuite/gcc.dg/analyzer/pr93032-mztools.c  
 -fno-diagnostics-show-caret -fno-diagnostics-show-line-numbers
-fdiagnostics-color=never  -fdiagnostics-urls=never   -fanalyzer
-fdiagnostics-path-format=separate-events -Wanalyzer-too-complex
-fanalyzer-call-summaries -S -o pr93032-mztools.s(timeout = 300)
spawn -ignore SIGHUP /home/seurer/gcc/git/build/gcc-test/gcc/xgcc
-B/home/seurer/gcc/git/build/gcc-test/gcc/
/home/seurer/gcc/git/gcc-test/gcc/testsuite/gcc.dg/analyzer/pr93032-mztools.c
-fno-diagnostics-show-caret -fno-diagnostics-show-line-numbers
-fdiagnostics-color=never -fdiagnostics-urls=never -fanalyzer
-fdiagnostics-path-format=separate-events -Wanalyzer-too-complex
-fanalyzer-call-summaries -S -o pr93032-mztools.s
/home/seurer/gcc/git/gcc-test/gcc/testsuite/gcc.dg/analyzer/pr93032-mztools.c:
In function 'unzRepair':
/home/seurer/gcc/git/gcc-test/gcc/testsuite/gcc.dg/analyzer/pr93032-mztools.c:261:11:
warning: terminating analysis for this program point: EN: 841-849
[-Wanalyzer-too-complex]
/home/seurer/gcc/git/gcc-test/gcc/testsuite/gcc.dg/analyzer/pr93032-mztools.c:261:11:
warning: terminating analysis for this program point: EN: 841-849
[-Wanalyzer-too-complex]
/home/seurer/gcc/git/gcc-test/gcc/testsuite/gcc.dg/analyzer/pr93032-mztools.c:261:11:
warning: terminating analysis for this program point: EN: 841-849
[-Wanalyzer-too-complex]
/home/seurer/gcc/git/gcc-test/gcc/testsuite/gcc.dg/analyzer/pr93032-mztools.c:261:11:
warning: terminating analysis for this program point: EN: 841-849
[-Wanalyzer-too-complex]
/home/seurer/gcc/git/gcc-test/gcc/testsuite/gcc.dg/analyzer/pr93032-mztools.c:261:11:
warning: terminating analysis for this program point: EN: 841-849
[-Wanalyzer-too-complex]
/home/seurer/gcc/git/gcc-test/gcc/testsuite/gcc.dg/analyzer/pr93032-mztools.c:261:11:
warning: terminating analysis for this program point: EN: 841-849
[-Wanalyzer-too-complex]
/home/seurer/gcc/git/gcc-test/gcc/testsuite/gcc.dg/analyzer/pr93032-mztools.c:261:11:
warning: terminating analysis for this program point: EN: 841-849
[-Wanalyzer-too-complex]
/home/seurer/gcc/git/gcc-test/gcc/testsuite/gcc.dg/analyzer/pr93032-mztools.c:261:11:
warning: terminating analysis for this program point: EN: 841-849
[-Wanalyzer-too-complex]
/home/seurer/gcc/git/gcc-test/gcc/testsuite/gcc.dg/analyzer/pr93032-mztools.c:261:11:
warning: terminating analysis for this program point: EN: 841-849
[-Wanalyzer-too-complex]
/home/seurer/gcc/git/gcc-test/gcc/testsuite/gcc.dg/analyzer/pr93032-mztools.c:261:11:
warning: terminating analysis for this program point: EN: 841-849
[-Wanalyzer-too-complex]
/home/seurer/gcc/git/gcc-test/gcc/testsuite/gcc.dg/analyzer/pr93032-mztools.c:261:11:
warning: terminating analysis for this program point: EN: 841-849
[-Wanalyzer-too-complex]
/home/seurer/gcc/git/gcc-test/gcc/testsuite/gcc.dg/analyzer/pr93032-mztools.c:261:11:
warning: terminating analysis for this program point: EN: 841-849
[-Wanalyzer-too-complex]
/home/seurer/gcc/git/gcc-test/gcc/testsuite/gcc.dg/analyzer/pr93032-mztools.c:261:11:
warning: terminating analysis for this program point: EN: 841-849
[-Wanalyzer-too-complex]
/home/seurer/gcc/git/gcc-test/gcc/testsuite/gcc.dg/analyzer/pr93032-mztools.c:261:11:
warning: terminating analysis for this program point: EN: 841-849
[-Wanalyzer-too-complex]
/home/seurer/gcc/git/gcc-test/gcc/testsuite/gcc.dg/analyzer/pr93032-mztools.c:261:11:
warning: terminating analysis for this program point: EN: 841-849
[-Wanalyzer-too-complex]
/home/seurer/gcc/git/gcc-test/gcc/testsuite/gcc.dg/analyzer/pr93032-mztools.c:261:11:
warning: terminating analysis for this program point: EN: 841-849
[-Wanalyzer-too-complex]
/home/seurer/gcc/git/gcc-test/gcc/testsuite/gcc.dg/analyzer/pr93032-mztools.c:261:11:
warning: terminating analysis for this program point: EN: 841-849
[-Wanalyzer-too-complex]
/home/seurer/gcc/git/gcc-test/gcc/testsuite/gcc.dg/analyzer/pr93032-mztools.c:261:11:
warning: terminating analysis for this program point: EN: 841-849
[-Wanalyzer-too-complex]
/home/seurer/gcc/git/gcc-test/gcc/testsuite/gcc.dg/analyzer/pr93032-mztools.c:261:11:
warning: terminating analysis for this program point: EN: 841-849
[-Wanalyzer-too-complex]