public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r10-9658] Darwin : Fix out-of-bounds access to df_regs_ever_live.
@ 2021-04-04 19:45 Iain D Sandoe
0 siblings, 0 replies; only message in thread
From: Iain D Sandoe @ 2021-04-04 19:45 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:093788fb96837a3657f94ab288355f8bc8256a67
commit r10-9658-g093788fb96837a3657f94ab288355f8bc8256a67
Author: Iain Sandoe <iain@sandoe.co.uk>
Date: Sat Apr 3 10:07:48 2021 +0100
Darwin : Fix out-of-bounds access to df_regs_ever_live.
During changes made for LRA (or, perhaps, even before) we omitted
a check that the current register we are working on is a hard reg
before we tried to note its liveness.
A stage 1 built with fsanitize=address catches this, as does any
attempt to build master with clang and -std=c++11.
gcc/ChangeLog:
* config/darwin.c (machopic_legitimize_pic_address): Check
that the current pic register is one of the hard reg set
before setting liveness.
(cherry picked from commit 89bc1d4e7cdd0b2d012050134ad1d464ec357f0b)
Diff:
---
gcc/config/darwin.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index ef77a50e709..89513c0d145 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -910,7 +910,7 @@ machopic_legitimize_pic_address (rtx orig, machine_mode mode, rtx reg)
emit_use (gen_rtx_REG (Pmode, PIC_OFFSET_TABLE_REGNUM));
#endif
- if (lra_in_progress)
+ if (lra_in_progress && HARD_REGISTER_P (pic))
df_set_regs_ever_live (REGNO (pic), true);
pic_ref = gen_rtx_PLUS (Pmode, pic,
machopic_gen_offset (XEXP (orig, 0)));
@@ -980,7 +980,8 @@ machopic_legitimize_pic_address (rtx orig, machine_mode mode, rtx reg)
#if 0
emit_use (pic_offset_table_rtx);
#endif
- if (lra_in_progress)
+
+ if (lra_in_progress && HARD_REGISTER_P (pic))
df_set_regs_ever_live (REGNO (pic), true);
pic_ref = gen_rtx_PLUS (Pmode,
pic,
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-04-04 19:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-04 19:45 [gcc r10-9658] Darwin : Fix out-of-bounds access to df_regs_ever_live Iain D Sandoe
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).