https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108580
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to postmaster from comment #2) > If I try to shift to highest bit of signed type, the compiler will reject > the code and that is correct behaviour. The point here is that left-hand > side of the shift operation is by default same size as "int", as in 32 bits, > which means it can't be promoted to "int" again. You are mixing up different things here. In the original code, it was not promoting to int. malloc takes size_t as an argument ....