https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85071
--- Comment #3 from wierton <141242068 at smail dot nju.edu.cn> --- (In reply to Jonathan Wakely from comment #2) > Both valgrind and AddressSanitizer would have found this bug, you should use > them. I feel so sorry to post this stupid code. I re-checked it using valgrind and re-checked the logic, and then found the problem as you mentioned. Thanks for your patient explanation.