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

--- Comment #2 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:d564a83d14252d7db01381f71900b7a68357803b

commit r12-6323-gd564a83d14252d7db01381f71900b7a68357803b
Author: David Malcolm <dmalc...@redhat.com>
Date:   Thu Jan 6 11:39:54 2022 -0500

    analyzer: make use of may_be_aliased in alias detection [PR103546]

    Whilst debugging PR analyzer/103546 (false +ve in flex-generated lexers)
    I noticed that the analyzer was considering that writes through symbolic
    pointers could be treated as clobbering static globals such as:

       static YY_BUFFER_STATE * yy_buffer_stack = NULL;

    even for such variables that never have their address taken.

    This patch fixes this issue at least, so that the analyzer can preserve
    knowledge of such globals on code paths with writes through symbolic
    pointers.

    It does not fix the false +ve in the lexer code.

    gcc/analyzer/ChangeLog:
            PR analyzer/103546
            * store.cc (store::eval_alias_1): Refactor handling of decl
            regions, adding a test for may_be_aliased, rejecting those for
            which it returns false.

    gcc/testsuite/ChangeLog:
            PR analyzer/103546
            * gcc.dg/analyzer/aliasing-3.c: New test.

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

Reply via email to