Thanks, that's a Gnulib bug that was fixed here: https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=b19a10775e54f8ed17e3a8c08a72d261d8c26244
This has been propagated to GNU Grep and the fix should appear in the next Grep release. I plan to reply separately about GNU Sed.