From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 67A84386F41E; Fri, 14 Aug 2020 22:43:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 67A84386F41E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1597445036; bh=mil6AJ99O0zl8fGK3pwEXx62zH8lUeEwUPr6htnl6/c=; h=From:To:Subject:Date:In-Reply-To:References:From; b=OnEbyx0fegnfH1pbwQd09FXtw42kbnbDXGa/JeEiL+wr1rG567a5GCRjfO1IinSTK G7v9DLyHrUdLz86jUoquLhKjQ1DRVpQWPv65J6ZcxRHik5IdDPHpzmsRGieKhC7kIW OqQ8v4Fex52KAewJ7OptbGy+AXk1z6CdsLSbG7tI= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug testsuite/96609] new test case gcc.dg/analyzer/init.c has many failures Date: Fri, 14 Aug 2020 22:43:56 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: testsuite X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Aug 2020 22:43:56 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96609 --- 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 =3D *.LC0; where "*.LC0" is a var_decl with DECL_IN_CONSTANT_POOL set. For example, in test_7: struct coord c[2] =3D {{3, 4}, {5, 6}}; __analyzer_eval (c[0].x =3D=3D 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 =3D=3D 3 would then generate: cluster for: _2: (SUB(SUB(INIT_VAL(*.LC0), c[(int)0]), c[(int)0].x)=3D=3D(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 d= ecl. * 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.=