https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119951

--- Comment #3 from Chenyi Wang <invisparent at outlook dot com> ---
(In reply to Andrew Pinski from comment #2)
> The problem is the same as PR 109267. Can you try the patch in PR 109267
> which I just attached, it is against GCC 16 but this area in the file has
> not changed since GCC 12 (r12-4616-g9262ae450d6a57).
> 
> *** This bug has been marked as a duplicate of bug 109267 ***

Hi Andrew,

Briefly, your patch does work!

Here are some details:

When I switched to Linux(Ubuntu 24.04 LTS), use both gcc-13.3.0 and 14.2.0
(from apt-get install), I couldn't trigger this bug again, no matter what flags
I've set, program always output 123.
Knowing this bug may cause linkage problem (at least it's os-dependent),
performing verification on Windows system is necessary.
I chose gcc-14.2.0, one performs cross-compilation directly (original version),
but another applied this patch first, then do cross-compilation (patched
version).
Finally I got compilers that --host,target=x86_64-w64-mingw32.
Back to Windows, patched version behaves normally (outputs 123), with flags
-std=c++17,23 -O0,1,2,3. But the original version only outputs 123 with
-std=c++17 -O0 and -std=c++23 -O0,2,3, otherwise program crashes.
So I do think this patch works.

Extra info:
binutils: v2.44
mingw-w64: v12.0.0

Reply via email to