* [PATCH] Fix a pasto in lra-remat.c (reg_overlap_for_remat_p)
@ 2017-09-01 20:33 Jakub Jelinek
2017-09-02 12:38 ` Richard Biener
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2017-09-01 20:33 UTC (permalink / raw)
To: Vladimir Makarov, Jeff Law, Bernd Schmidt; +Cc: gcc-patches
Hi!
This is something that has been reported privately to me.
This is in code introduced in
https://gcc.gnu.org/ml/gcc-patches/2016-03/msg00660.html
and looks indeed like a pasto to me, before the loop there is
a very similar set of stmts without the 2 suffix, and unless
regno being a hard reg (after possible reg_renumber) implies
that regno2 (after possible reg_renumber) is a hard reg, if
unlucky we might access out of bounds.
I don't have a testcase for this, but have bootstrapped/regtested
it on x86_64-linux and i686-linux, ok for trunk?
2017-09-01 Jakub Jelinek <jakub@redhat.com>
* lra-remat.c (reg_overlap_for_remat_p): Fix a pasto.
--- gcc/lra-remat.c.jj 2017-05-25 10:37:00.000000000 +0200
+++ gcc/lra-remat.c 2017-09-01 19:42:07.615291583 +0200
@@ -684,7 +684,7 @@ reg_overlap_for_remat_p (lra_insn_reg *r
if (regno2 >= FIRST_PSEUDO_REGISTER && reg_renumber[regno2] >= 0)
regno2 = reg_renumber[regno2];
- if (regno >= FIRST_PSEUDO_REGISTER)
+ if (regno2 >= FIRST_PSEUDO_REGISTER)
nregs2 = 1;
else
nregs2 = hard_regno_nregs[regno2][reg->biggest_mode];
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix a pasto in lra-remat.c (reg_overlap_for_remat_p)
2017-09-01 20:33 [PATCH] Fix a pasto in lra-remat.c (reg_overlap_for_remat_p) Jakub Jelinek
@ 2017-09-02 12:38 ` Richard Biener
0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2017-09-02 12:38 UTC (permalink / raw)
To: Jakub Jelinek, Vladimir Makarov, Jeff Law, Bernd Schmidt; +Cc: gcc-patches
On September 1, 2017 10:33:10 PM GMT+02:00, Jakub Jelinek <jakub@redhat.com> wrote:
>Hi!
>
>This is something that has been reported privately to me.
>This is in code introduced in
>https://gcc.gnu.org/ml/gcc-patches/2016-03/msg00660.html
>and looks indeed like a pasto to me, before the loop there is
>a very similar set of stmts without the 2 suffix, and unless
>regno being a hard reg (after possible reg_renumber) implies
>that regno2 (after possible reg_renumber) is a hard reg, if
>unlucky we might access out of bounds.
>
>I don't have a testcase for this, but have bootstrapped/regtested
>it on x86_64-linux and i686-linux, ok for trunk?
OK.
Richard.
>2017-09-01 Jakub Jelinek <jakub@redhat.com>
>
> * lra-remat.c (reg_overlap_for_remat_p): Fix a pasto.
>
>--- gcc/lra-remat.c.jj 2017-05-25 10:37:00.000000000 +0200
>+++ gcc/lra-remat.c 2017-09-01 19:42:07.615291583 +0200
>@@ -684,7 +684,7 @@ reg_overlap_for_remat_p (lra_insn_reg *r
>
> if (regno2 >= FIRST_PSEUDO_REGISTER && reg_renumber[regno2] >= 0)
> regno2 = reg_renumber[regno2];
>- if (regno >= FIRST_PSEUDO_REGISTER)
>+ if (regno2 >= FIRST_PSEUDO_REGISTER)
> nregs2 = 1;
> else
> nregs2 = hard_regno_nregs[regno2][reg->biggest_mode];
>
> Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-09-02 12:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-01 20:33 [PATCH] Fix a pasto in lra-remat.c (reg_overlap_for_remat_p) Jakub Jelinek
2017-09-02 12:38 ` Richard Biener
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).