On Fri, Jun 10, 2022 at 12:58 PM Eric Botcazou via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Hi,
>
> gimple_set_location is mostly invoked on newly built GIMPLE statements, so
> their location is UNKNOWN_LOCATION and setting it will clobber the warning
> data of the passed location, if any.

Hmm, I think instead of special-casing UNKNOWN_LOCATION
what gimple_set_location should probably do is either not copy
warnings at all or union them.  Btw, gimple_set_location also
removes a previously set BLOCK (but gimple_set_block preserves
the location locus and diagnostic override).

So I'd be tempted to axe the copy_warning () completely here.  Martin,
there were
probably cases that warranted it - do you remember anything specific here?

Thanks,
Richard.

> Tested on x86-64/Linux, OK for mainline and 12 branch?
>
>
> 2022-06-10  Eric Botcazou  <ebotca...@adacore.com>
>
>         * gimple.h (gimple_set_location): Do not copy warning data from
>         the previous location when it is UNKNOWN_LOCATION.
>
>
> 2022-06-10  Eric Botcazou  <ebotca...@adacore.com>
>
> testsuite/
>         * c-c++-common/nonnull-1.c: Remove XFAIL for C++.
>
> --
> Eric Botcazou

Reply via email to