Ping: https://gcc.gnu.org/ml/gcc-patches/2018-07/msg01884.html
On 07/30/2018 05:51 PM, Martin Sebor wrote:
The middle-end contains code to determine the lengths of constant character arrays initialized by string literals. The code is used in a number of optimizations and warnings. However, the code is unable to deal with constant arrays initialized using the braced initializer syntax, as in const char a[] = { '1', '2', '\0' }; The attached patch extends the C and C++ front-ends to convert such initializers into a STRING_CST form. The goal of this work is to both enable existing optimizations for such arrays, and to help detect bugs due to using non-nul terminated arrays where nul-terminated strings are expected. The latter is an extension of the GCC 8 _Wstringop-overflow and -Wstringop-truncation warnings that help detect or prevent reading past the end of dynamically created character arrays. Future work includes detecting potential past-the-end reads from uninitialized local character arrays. Tested on x86_64-linux. Martin