[Bug target/126382] [16/17 regression] Incorrect compiler generated code resulting in seg fault - hoisted tls() in x86_cse caused register clobbering

"cvs-commit at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126382

--- Comment #10 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-16 branch has been updated by H.J. Lu <[email protected]>:

https://gcc.gnu.org/g:d00d5b7eddea4217ac6d85cf51e4604b9a187cc5

commit r16-9436-gd00d5b7eddea4217ac6d85cf51e4604b9a187cc5
Author: Reshma Roy <[email protected]>
Date:   Tue Jul 28 16:55:24 2026 +0530

    x86_cse: Check if DRAP is live with DF_LR_IN.

    The DRAP register has no reaching definition on function entry, so it
    never shows up in DF_LIVE_IN.  When collecting the live caller-saved
    registers, additionally set DRAP's bit whenever it is live-in per
    DF_LR_IN, so the hoisted TLS call is kept after the DRAP save.

    PR target/126382

    gcc/ChangeLog:

            * config/i386/i386-features.cc (ix86_emit_tls_call): Additional
            check to see if DRAP register is live in basic block with DF_LR_IN.

    gcc/testsuite/ChangeLog:

            * gcc.target/i386/pr126382.c: New test.

    (cherry picked from commit af8dbc9ccf8209007e38a923c3c158e9e8f4396d)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.