Rating changes for last rounds are temporarily rolled back. They will be returned soon. ×

Have I come up with a compiler bug?
Difference between en1 and en2, changed 145 character(s)
**UPD: It is a compiler bug, and is resolved since gcc 12.3. Further information is on https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116459.**↵

[Apologize for my poor English.]↵

The code at https://godbolt.org/z/PP1TTdhxf outputs 1. However, if you simulate the code, the answer is obviously 20.↵

Further exploration showed that the compiler compiled function qpw, but did not call it. Uncomment line 22 solves the issue, surprisingly. Further more, the bug seems to only occur on gcc12.1 and gcc12.2, with -O2 enabled.↵

I believe the code does not contain any undefined / unspecified behavior.↵

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English Xiaohuba 2024-08-22 16:50:15 4 Tiny change: '?id=116459.**\n\n[Apo' -> '?id=116459**\n\n[Apo'
en2 English Xiaohuba 2024-08-22 16:48:49 145
en1 English Xiaohuba 2024-08-22 05:46:34 495 Initial revision (published)