glib: fix build on FSF GCC

Fixes #23393.