https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116471
--- Comment #4 from Giuseppe D'Angelo <dangelog at gmail dot com> --- Created attachment 58984 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58984&action=edit patch v1 Attaching a patch for this + PR108846 , since the testcases basically cover both in one go.