public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug analyzer/96616] Many new analyzer failures
Date: Fri, 14 Aug 2020 22:43:56 +0000	[thread overview]
Message-ID: <bug-96616-4-zYilzv7bJ7@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-96616-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96616

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by David Malcolm <dmalcolm@gcc.gnu.org>:

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

commit r11-2708-g2867118ddda9b56d991c16022f7d3d634ed08313
Author: David Malcolm <dmalcolm@redhat.com>
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.

  parent reply	other threads:[~2020-08-14 22:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-14 15:59 [Bug analyzer/96616] New: " segher at gcc dot gnu.org
2020-08-14 16:18 ` [Bug analyzer/96616] " dmalcolm at gcc dot gnu.org
2020-08-14 22:43 ` cvs-commit at gcc dot gnu.org [this message]
2020-08-14 22:57 ` dmalcolm at gcc dot gnu.org
2020-08-14 22:59 ` dmalcolm at gcc dot gnu.org
2020-08-17 12:46 ` [Bug analyzer/96616] pr93032-mztools.c -Wanalyzer-too-complex warnings on some targets dmalcolm at gcc dot gnu.org
2020-08-25 18:19 ` dmalcolm at gcc dot gnu.org
2020-09-16 23:02 ` cvs-commit at gcc dot gnu.org
2020-09-16 23:21 ` dmalcolm at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-96616-4-zYilzv7bJ7@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).