https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94578
--- Comment #11 from Jan-Willem Blokland <howisjw at hotmail dot com> --- If you make use of an temporary variable, it sounds like you will do an additional memory copy. Therefore, I am wondering what the performance impact will be. Naively, I would think the span solution would be faster. I must admit, I do realize I say this all without knowing the current implementation. So you should read my question/comment as fix the issue and later worry about making the fix as fast as possible. From my personal experience, making it fast is easily said than done. I am already happy that you looking into this issue and try to solve it.