If you have time, it would be really interesting to add -S to the compile lines for that file with -O2 and without your change with -O2 and with your change with -Os and your change and read the assembly. I suspect that in the -O2 case the NULL assignment is optimized out, because the compiler can provde that it wasn't necessary, and with -Os it's present, because that proof wasn't successful and hence the failure. Any objections to me adding the NULL assignment?
Attachment:
pgpdjN8cCpGzk.pgp
Description: PGP signature