https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55791
--- Comment #4 from Eric Gallager <egallager at gcc dot gnu.org> --- For reference, clang catches this with its static analyzer: $ clang --analyze 55791.c 55791.c:10:15: warning: Result of 'malloc' is converted to a pointer of type 'char', which is incompatible with sizeof operand type 'char *' p = (char *) malloc( 10 * sizeof( char *)); ~~~~~~ ^~~~~~ ~~~~~~~~~~~~~~~ 1 warning generated. $ Since gcc will be getting a static analyzer, too, once David Malcolm's analyzer branch is merged, we could do this warning there, but I think it would make more sense to do this warning in the compiler proper, though.