On Mon, Dec 16, 2024 at 01:16:37PM +0100, Torbjörn SVENSSON wrote:
> Hi,
> 
> I've reg-tested this patch on both the trunk and the releases/gcc-14
> branches for x86_64-linux-gnu and arm-none-eabi and it no longer fails
> for any of the out-of-bounds-diagram* tests on any of the 2 platforms.
> 
> I'm a bit puzzled if the C++ part is enough, but I can't think of a way
> to trigger anything that show the wrong output after my change.
> Do you think that I need to add any additional tests? I think the
> existing test covers the problem well enough.
> 
> Ok for trunk and releases/gcc-14?
> 
> --
> 
> gcc/ChangeLog:
> 
>       PR c/116060
>       c/c-typeck.cc: Make sure left hand side and right hand side has
>       identical named types to aid diagnostic output.
>       cp/call.cc: Likewise.

Please drop the c/ and cp/ prefixes.  There should be an entry for
c/ChangeLog and another one for cp/ChangeLog.
 
> gcc/testsuite/ChangeLog:
> 
>       PR c/116060
>       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.
> 
> Signed-off-by: Torbjörn SVENSSON <torbjorn.svens...@foss.st.com>
> ---
>  gcc/c/c-typeck.cc                             |  3 ++
>  gcc/cp/call.cc                                |  9 ++++++
>  .../analyzer/out-of-bounds-diagram-11.c       | 28 +++++++++----------
>  .../analyzer/out-of-bounds-diagram-8.c        | 28 +++++++++----------
>  .../analyzer/out-of-bounds-diagram-10.c       | 28 +++++++++----------
>  5 files changed, 54 insertions(+), 42 deletions(-)
> 
> diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc
> index 902898d1944..e3e85d1ecde 100644
> --- a/gcc/c/c-typeck.cc
> +++ b/gcc/c/c-typeck.cc
> @@ -7831,6 +7831,9 @@ convert_for_assignment (location_t location, location_t 
> expr_loc, tree type,
>    if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (rhstype))
>      {
>        warn_for_address_of_packed_member (type, orig_rhs);
> +      if (type != rhstype)
> +     /* Convert RHS to TYPE in order to not loose TYPE in diagnostics.  */

As in cp/, loose -> lose.

Marek

Reply via email to