https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82146
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- This has nothing to do with a new standard, *(CMaaString *)NULL is simply undefined behaviour, and that has alawys been true. You cannot dereference a null pointer. The bug is there, not inside MyFunc or inside NotWorkedAround. Stop dereferencing null pointers. If the code worked in the past that doesn't make it correct. It was wrong then and it's wrong now. Because dereferencing a null pointer is undefined you cannot expect consistent results. What happens can change depending on optimization level or compiler version.