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

--- Comment #4 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:9d2c0fad59745bf67aa6471e8c9e96c351f0de59

commit r12-7086-g9d2c0fad59745bf67aa6471e8c9e96c351f0de59
Author: David Malcolm <dmalc...@redhat.com>
Date:   Thu Feb 3 16:21:27 2022 -0500

    analyzer: fixes to memcpy [PR103872]

    PR analyzer/103872 reports a failure of gcc.dg/analyzer/pr103526.c on
    riscv64-unknown-elf-gcc.  The issue is that I wrote the test on x86_64
    where a memcpy in the test is optimized to a write to a read/write pair,
    whereas due to alignment differences the analyzer can see it as a
    memcpy call, revealing problems with the analyzer's implementation
    of memcpy.

    This patch reimplements region_model::impl_call_memcpy in terms of a
    get_store_value followed by a set_value, fixing the issue.

    gcc/analyzer/ChangeLog:
            PR analyzer/103872
            * region-model-impl-calls.cc (region_model::impl_call_memcpy):
            Reimplement in terms of a get_store_value followed by a set_value.

    gcc/testsuite/ChangeLog:
            PR analyzer/103872
            * gcc.dg/analyzer/memcpy-1.c: Add alternate versions of test cases
            in which the calls to memcpy are hidden from the optimizer.  Add
            further test cases.
            * gcc.dg/analyzer/taint-size-1.c: Add test coverage for memcpy
            with tainted size.

    Signed-off-by: David Malcolm <dmalc...@redhat.com>

Reply via email to