Re: [PATCH] fold strlen() of substrings within strings (PR 86415)

2018-07-05 Thread Jeff Law
On 07/05/2018 05:54 PM, Martin Sebor wrote: > GCC folds strlen() calls to empty substrings within arrays > whose elements are explicitly initialized with NULs but > fails to do the same for elements that are zeroed out > implicitly.  For example: > >   const char a[7] = "123\000\000\000"; >   int 

[PATCH] fold strlen() of substrings within strings (PR 86415)

2018-07-05 Thread Martin Sebor
GCC folds strlen() calls to empty substrings within arrays whose elements are explicitly initialized with NULs but fails to do the same for elements that are zeroed out implicitly. For example: const char a[7] = "123\000\000\000"; int f (void) { return strlen (a + 5); // folded }