------- Comment #3 from jakub at gcc dot gnu dot org 2010-01-19 10:21 ------- This is undefined behavior, scanf is writing int value into an unsigned short variable, so it of course can overwrite whatever happens to be adjacent to that var on the stack. Use %hd instead of %d to write to short/unsigned short vars in scanf format string, or write to int variable instead.
-- jakub at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |INVALID http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42799