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

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Uecker <[email protected]>:

https://gcc.gnu.org/g:7149edfb90f3279f89b76942d3d0c9b94912bcad

commit r17-1269-g7149edfb90f3279f89b76942d3d0c9b94912bcad
Author: Martin Uecker <[email protected]>
Date:   Mon Jun 1 20:57:09 2026 +0200

    c: fix wrong code with counted_by attribute [PR123569]

    For an access to a member of pointer type with counted_by attribute,
    the .ACCESS_WITH_SIZE internal function is inserted at certain places
    before reading the pointer.  This leads to wrong code for increment
    and decrement operations.  For now, do not instrument these accesses
    by using default_array_function_conversion instead of
    default_array_function_read_conversion and calling mark_exp_read_
    directly.  Code to undo the effect of mark_exp_read can be removed,
    and the logic is moved into a helper function mark_exp_read_cond.

            PR c/123569

    gcc/c/ChangeLog:
            * c-parser.cc (mark_exp_read_cond): New function.
            (c_parser_unary_expression): Use mark_exp_read_cond.
            (c_parser_postfix_expression_after_primary): Likewise.
            * c-typeck.cc (build_unary_op): Remove dead code and
            add checking assertion.

    gcc/testsuite/ChangeLog:
            * gcc.dg/pr123569.c: New test.

Reply via email to