https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67154
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Not a bug. Scanf with %c writes to a char pointer so if you look at the correct byte of the integer (big and little endian targets would cause a difference) you will see it places the correct value there and left the other bytes as what they were before calling scanf. If you had compiled with -W -Wall you would have seen a warning about this.