https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122610
--- Comment #13 from liu zhenyu <lzy20000419 at outlook dot com> --- Created attachment 62957 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=62957&action=edit Screenshot demonstrating non-deterministic behavior on Windows/MinGW Update on reproduction analysis: I have conducted extensive testing across different versions (GCC 11.4 to Trunk) and platforms (Linux & Windows/MinGW). I observed that the miscompilation is HIGHLY SENSITIVE to memory layout (ASLR) and exhibits non-deterministic behavior. Key Findings: 1. Non-Determinism (Heisenbug): Even with the exact same binary and flags, the issue fluctuates between PASS (correct result) and FAIL (result + 1000) across consecutive runs. This strongly suggests the optimization decision in ipa-modref is affected by runtime memory layout or internal non-deterministic hashing. (See attached screenshot). 2. Automated Reproduction: I have attached a Python script (`112610.py`) that loops through optimization levels to catch this transient failure. I highly recommend running it multiple times if the issue does not appear immediately. 3. Affected Versions: The issue is reproducible as far back as GCC 11.4 (e.g., g++ -O1), confirming this is a long-standing latent bug in the modref analysis, which has seemingly worsened in the recent Trunk (affecting C -O2). Best reproduction target: g++ -O1 (seems to trigger the failure most frequently across platforms).
