]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: Fix typo in RAW_DATA_CST build_list_conv subsubconv hanling [PR119563]
authorJakub Jelinek <jakub@redhat.com>
Thu, 3 Apr 2025 11:21:56 +0000 (13:21 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 3 Apr 2025 11:21:56 +0000 (13:21 +0200)
commit70bf0ee44017e8e26bb1bdcb6a3fd114c25c39c7
tree1ae9024ac356dd4c05dae8550125f137f2971b03
parent564e4e0819022925dd160e455ee44baf0fda5805
c++: Fix typo in RAW_DATA_CST build_list_conv subsubconv hanling [PR119563]

The following testcase ICEs (the embed one actually doesn't but
dereferences random uninitialized pointer far after allocated memory)
because of a typo.  In the RAW_DATA_CST handling of list conversion
where there are conversions to something other than
initializer_list<{{,un}signed ,}char>, the code now calls
implicit_conversion for all the RAW_DATA_CST elements and stores them
into subsubconvs array.
The next loop (done in a separate loop because subsubconvs[0] is
handled differently) attempts to do the
  for (i = 0; i < len; ++i)
    {
      conversion *sub = subconvs[i];
      if (sub->rank > t->rank)
        t->rank = sub->rank;
      if (sub->user_conv_p)
        t->user_conv_p = true;
      if (sub->bad_p)
        t->bad_p = true;
    }
rank/user_conv_p/bad_p merging, but I mistyped the index, the loop
iterates with j iterator and i is subconvs index, so the loop effectively
doesn't do anything interesting except for merging from one of the
subsubconvs element, if lucky within the subsubconvs array, if unlucky
not even from inside of the array.

The following patch fixes that.

2025-04-03  Andrew Pinski  <quic_apinski@quicinc.com>
    Jakub Jelinek  <jakub@redhat.com>

PR c++/119563
* call.cc (build_list_conv): Fix a typo in loop gathering
summary information from subsubconvs.

* g++.dg/cpp0x/pr119563.C: New test.
* g++.dg/cpp/embed-26.C: New test.
gcc/cp/call.cc
gcc/testsuite/g++.dg/cpp/embed-26.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp0x/pr119563.C [new file with mode: 0644]