Have I come up with a compiler bug?

Правка en1, от Xiaohuba, 2024-08-22 05:46:34

[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.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский Xiaohuba 2024-08-22 16:50:15 4 Tiny change: '?id=116459.**\n\n[Apo' -> '?id=116459**\n\n[Apo'
en2 Английский Xiaohuba 2024-08-22 16:48:49 145
en1 Английский Xiaohuba 2024-08-22 05:46:34 495 Initial revision (published)