https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124183 --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- So this code does have an issue you don't check the return value of malloc which can be null if running out of memory ...