https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101537
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 52105
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52105&action=edit
gcc12-pr101537.patch
Untested fix. The PR101537 is fixed by this in both C and C++, PR103881 only
in C; for C++ we end up with a COMPOUND_EXPR with TARGET_EXPR and then
BIT_IOR_EXPR of something and the TARGET_EXPR_DECL. We'd need to remember when
looking through COMPOUND_EXPRs if they don't have TARGET_EXPRs on the lhs and
if so, remember for conversion_warning the mapping from their TARGET_EXPR_DECLs
to those TARGET_EXPRs, so that we could then look those up.
But it seems unsafe_conversion_p has some BIT_*_EXPR handling code, so that
would need to be copied over into conversion_warning too.
Or perhaps alternatively we could change unsafe_conversion_p to handle whatever
is missing in there (SAVE_EXPRs, TARGET_EXPRs etc.).