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

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Jason Merrill <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:c6b54302df470bf09801ad6785d5713ef23dcb38

commit r15-6744-gc6b54302df470bf09801ad6785d5713ef23dcb38
Author: Jason Merrill <ja...@redhat.com>
Date:   Mon Dec 23 09:18:41 2024 -0500

    c, c++: preserve type name in conversion [PR116060]

    When the program requests a conversion to a typedef, let's try harder to
    remember the new name.

    Torbjörn's original patch changed the type of the original expression, but
    that seems not generally desirable; we might want either or both of the
    original type and the converted-to type to be represented.  So this
    expresses the name change as a NOP_EXPR.

    Compiling stdc++.h, this adds 519 allocations out of 1870k, or 0.28%.

    The -Wsuggest-attribute=format change was necessary to do the check before
    converting to the target type, which seems like an improvement.

            PR c/116060

    gcc/c/ChangeLog:

            * c-typeck.cc (convert_for_assignment): Make sure left hand side
and
            right hand side has identical named types to aid diagnostic output.

    gcc/cp/ChangeLog:

            * call.cc (standard_conversion): Preserve type name in ck_identity.
            (maybe_adjust_type_name): New.
            (convert_like_internal): Use it.
            Handle -Wsuggest-attribute=format here.
            (convert_for_arg_passing): Not here.

    gcc/testsuite/ChangeLog:

            * c-c++-common/analyzer/out-of-bounds-diagram-8.c: Update to
            correct type.
            * c-c++-common/analyzer/out-of-bounds-diagram-11.c: Likewise.
            * gcc.dg/analyzer/out-of-bounds-diagram-10.c: Likewise.

    Co-authored-by: Torbjörn SVENSSON <torbjorn.svens...@foss.st.com>
    Signed-off-by: Torbjörn SVENSSON <torbjorn.svens...@foss.st.com>
  • [Bug analyzer/116060] -fanalyze... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to