https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79835
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|c |middle-end --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- You need to mark the variable as volatile as gcc thinks malloc does not change any global visiable state. There is a duplicate of this issue already but I can't find it right now.