Hi!

On Tue, Jan 28, 2025 at 12:49:54AM +0100, Jakub Jelinek wrote:
> The following testcases ICE with RAW_DATA_CSTs (so the first one since
> introduction of #embed C++ optimizations and the latter since optimization
> of large sequences of comma separated literals).
> I've missed the fact that implicit_conversion can embed the exact expression
> passed to it into stuff pointed out by conversion * (e.g. for user
> conversions in sub->cand->args).
> So, it isn't enough in convert_like_internal to pass the right INTEGER_CST
> for each element of the RAW_DATA_CST because the whole RAW_DATA_CST might be
> in sub->cand->args etc.
> Either I'd need to chase for wherever the RAW_DATA_CST is found and update
> those for each element processed, or, as implemented in the following patch,
> build_list_conv detects the easy optimizable case where
> convert_like_internal can be kept as the whole RAW_DATA_CST with changed
> type and possibly narrowing diagnostics, and otherwise instead of having
> a single subconversion it has RAW_DATA_LENGTH separate subconversions.
> Instead of trying to reallocate the subconvs array when we detect that case,
> the patch instead uses an artificial ck_list inside of the u.list array
> to hold the individual subconversions.
> Seems the only places where u.list is used are build_list_conv and
> convert_like_internal.
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

I'd like to ping the
https://gcc.gnu.org/pipermail/gcc-patches/2025-January/674625.html
patch.  It fixes an important P1 regression (sorry for introducing it).

Thanks.

> 2025-01-28  Jakub Jelinek  <ja...@redhat.com>
> 
>       PR c++/118671
>       * call.cc (build_list_conv): For RAW_DATA_CST, call
>       implicit_conversion with INTEGER_CST representing first byte instead
>       of the whole RAW_DATA_CST.  If it is an optimizable trivial
>       conversion, just save that to subconvs, otherwise allocate an
>       artificial ck_list for all the RAW_DATA_CST bytes and create
>       subsubconv for each of them.
>       (convert_like_internal): For ck_list with RAW_DATA_CST, instead of
>       doing all the checks for optimizable conversion just check kind and
>       assert everything else, otherwise use subsubconversions instead of
>       the subconversion for each element.
> 
>       * g++.dg/cpp/embed-25.C: New test.
>       * g++.dg/cpp0x/pr118671.C: New test.

        Jakub

Reply via email to