On 23/02/19 01:26 +0000, Jonathan Wakely wrote: >On 23/02/19 02:06 +0100, Jakub Jelinek wrote: >>On Sat, Feb 23, 2019 at 01:02:20AM +0000, Jonathan Wakely wrote: >>> PR libstdc++/89446 >>> * include/bits/char_traits.h (__constant_char_array): Check index is >>> in range before dereferencing. >>> * testsuite/21_strings/basic_string_view/operators/char/89446.cc: >>> New test. >>> >>>Tested x86_64-linux, committed to gcc-8-branch and gcc-7-branch. >> >>And not trunk? The bug is still there, even when it should be usually >>ifdefed out because __builtin_is_constexpr_evaluated() should be supported. > >Yes, that's a bigger patch (with some cleanup) which is coming >shortly. Here's the patch for trunk. When the size is zero we can just return, we don't need to do the __builtin_constant_p checks. Tested powerpc64le-linux, committed to trunk.