[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 #8 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by H.J. Lu <[email protected]>:

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

commit r17-2768-gaf8dbc9ccf8209007e38a923c3c158e9e8f4396d
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.
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.