https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116220
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- simple_object_write_create_section never fails - it would crash on allocation error instead. *err and *errmsg are only touched when there's an error (a NULL return). On error this returns NULL, sets *ERRMSG to an error message, and sets *ERR to an errno value or 0 if there isn't one. */ "the or 0 if there isn't one" sounds a bit confused. I _think_ this means the function should set *ERR to zero when there isn't an error. simple_object_write_add_data similarly documents On success this returns NULL. On error this returns an error message, and sets *ERR to an errno value or 0 if there isn't one. */ I think this makes the lto_obj_begin_section use bogus, the err == 0 case shouldn't happen when lo->section == NULL. Do you see this with an LTO build? Or maybe the diagnostic is confused about the const qualification for 'const char **errmsg' - it assumes const data isn't initialized by the function. But it's not 'char * const * errmsg'.