https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92893
--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
Defining Str like so works for the test case:
struct Str {
template<typename T1, typename T2> Str(Cat<T1, T2> c)
{
struct Flex { char c, a[]; } *p = (Flex*)get();
c.add(p->a);
}
};
by changing the IL the warning sees to:
<bb 2> [local count: 1073741824]:
_8 = __builtin_strlen (p_2(D));
_6 = get ();
MEM[(char * {ref-all})_6 + 1B] = 0;
_30 = &MEM <char[<unknown>]> [(void *)_6 + 2B]; <<< char[]
__builtin_memcpy (_30, p_2(D), _8);
_34 = _30 + _8;
MEM <unsigned int> [(char * {ref-all})_34] = 7895160;