https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25702
--- Comment #15 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Even (T*)malloc(n) where n < sizeof(T) is quite common, e.g. in GCC itself (well, we don't usually use malloc but some ggc_alloc*) - e.g. if T is a union and the code wants to allocate memory just for one of the union members, or if there is some struct at the beginning and user wants to allocate memory just for that initial struct rather than for the whole object.