public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/97682] Miscompiled tail call with -fPIC
Date: Tue, 17 Nov 2020 03:53:15 +0000	[thread overview]
Message-ID: <bug-97682-4-zbyCDtVLB3@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-97682-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Kito Cheng <kito@gcc.gnu.org>:

https://gcc.gnu.org/g:4ba2f918583089172ac899c8eecaddef0d47cd85

commit r10-9033-g4ba2f918583089172ac899c8eecaddef0d47cd85
Author: Monk Chiang <monk.chiang@sifive.com>
Date:   Fri Nov 13 19:35:11 2020 -0800

    PR target/97682 - Fix to reuse t1 register between call address and
epilogue.

      - When expanding the call pattern, choose t1 register be a jump register.
        Epilogue also uses a t1 register to adjust Stack point. The call
pattern
        and epilogue will initial t1 twice, if both are generated in the same
        function. The call pattern will emit 'la t1,symbol' and 'jalr
t1'instructions.
        Epilogue also emits 'li t1,4096' and 'addi sp,sp,t1' instructions.
        But li and addi instructions will be placed between la and jalr
instructions.
        The la instruction will be removed by some optimizations,
        because t1 register define twice, the first define instruction look
        likes duplicate.

      - To resolve this issue, Prologue and Epilogue use the t0 register
        be a temporary register, the call pattern use the t1 register be
        a temporary register.

    gcc/
    2020-11-13  Monk Chiang  <monk.chiang@sifive.com>

            PR target/97682
            * config/riscv/riscv.h (RISCV_PROLOGUE_TEMP_REGNUM): Change
register
            to t0.
            (RISCV_CALL_ADDRESS_TEMP_REGNUM): New Marco, define t1 register.
            (RISCV_CALL_ADDRESS_TEMP): Use it for call instructions.
            * config/riscv/riscv.c (riscv_legitimize_call_address): Use
            RISCV_CALL_ADDRESS_TEMP.
            (riscv_compute_frame_info): Change temporary register to t0 form
t1.
            (riscv_trampoline_init): Adjust comment.

    gcc/testsuite/
    2020-11-13  Monk Chiang  <monk.chiang@sifive.com>

            PR target/97682
            * g++.target/riscv/pr97682.C: New test.
            * gcc.target/riscv/interrupt-3.c: Check register for t0.
            * gcc.target/riscv/interrupt-4.c: Likewise.

    (cherry picked from commit 207de83922bda8707aa33d6a2185e691116377e7)

  parent reply	other threads:[~2020-11-17  3:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-02 21:53 [Bug target/97682] New: " schwab@linux-m68k.org
2020-11-02 22:08 ` [Bug target/97682] " schwab@linux-m68k.org
2020-11-02 23:15 ` schwab@linux-m68k.org
2020-11-03  7:25 ` kito at gcc dot gnu.org
2020-11-14  4:05 ` cvs-commit at gcc dot gnu.org
2020-11-17  3:53 ` cvs-commit at gcc dot gnu.org [this message]
2020-11-17  9:30 ` cvs-commit at gcc dot gnu.org
2020-11-17  9:59 ` kito at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-97682-4-zbyCDtVLB3@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).