https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71219
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> --- That example is just taken straight from the WG14 document I linked to. Maybe the compiler should also be able to presume that the allocation is intended for struct S1 if you do: struct S1 *p = malloc(sizeof(p)); but I wanted to suggest following exactly what the secure coding guidelines require.