Added volatile to offset variable. It causes crashes when compiled with -ftrapv flag.