https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68737
--- Comment #20 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Jonathan Wakely from comment #18) > +#ifdef __hpux > + if (__len == -1) > + return __s; > +#endif N.B. I really don't want to just abort here, nor assume that __len is valid, and then continue onwards with undefined behaviour. But I don't think this function has any way to report an error. Maybe it should throw an exception instead. It also occurs to me that in some cases we could reuse the original alloca result for the final output string instead of doing yet another alloca, e.g. if we alloca(5000) and find __len is less than (5000 / sizeof(wchar_t)) then we could reuse it. Or maybe beyond a certain size we should switch to the heap.