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

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

https://gcc.gnu.org/g:13f5b93e6453d121abc15c718dfcc588aca976c3

commit r10-6496-g13f5b93e6453d121abc15c718dfcc588aca976c3
Author: David Malcolm <dmalc...@redhat.com>
Date:   Thu Feb 6 14:17:48 2020 -0500

    analyzer: fix reproducer for PR 93375

    Reproducing the ICE in PR analyzer/93375 required some kind of
    analyzer diagnostic occurring after a call with fewer arguments
    than required by the callee.

    The testcase used __builtin_memcpy with a NULL argument for this.

    On x86_64-pc-linux-gnu this happened to be already optimized into:
      _4 = MEM <unsigned int> [(char * {ref-all})0B];
      MEM <unsigned int> [(char * {ref-all})rl_1] = _4;
    by the time of the analyzer pass, leading to the diagnostic in question
    being:
      warning: dereference of NULL ‘rl’ [CWE-690] [-Wanalyzer-null-dereference]

    On other targets e.g. arm-unknown-linux-gnueabi, the builtin isn't
    optimized at the time of the analyzer pass, leading to this diagnostic
    instead:
      warning: use of NULL ‘rl’ where non-null expected [CWE-690]
[-Wanalyzer-null-argument]
      <built-in>: note: argument 1 of ‘__builtin_memcpy’ must be non-null

    This patch fixes the test case by using a custom function marked as
    nonnull.  I manually verified that it still reproduces the ICE if the
    patch for the PR is reverted.

    gcc/testsuite/ChangeLog:
        PR analyzer/93375
        * gcc.dg/analyzer/pr93375.c: Rework test case to avoid per-target
        differences in how __builtin_memcpy has been optimized at the time
        the analyzer runs.

Reply via email to