diff mbox series

Fix patchable-function-entry on arc

Message ID 1579742724-5905-1-git-send-email-apinski@marvell.com
State New
Headers show
Series Fix patchable-function-entry on arc | expand

Commit Message

Andrew Pinski Jan. 23, 2020, 1:25 a.m. UTC
From: Andrew Pinski <apinski@marvell.com>

The problem here is arc looks at current_output_insn unconditional
but sometimes current_output_insn is NULL.  With patchable-function-entry,
it will be. This is similar to how the nios2, handles "%.".

Committed as obvious after a simple test with -fpatchable-function-entry=1.

ChangeLog:
* config/arc/arc.c (output_short_suffix): Check insn for nullness.
---
 gcc/ChangeLog        | 4 ++++
 gcc/config/arc/arc.c | 2 ++
 2 files changed, 6 insertions(+)

Comments

Jeff Law Jan. 23, 2020, 3:15 p.m. UTC | #1
On Wed, 2020-01-22 at 17:25 -0800, apinski@marvell.com wrote:
> From: Andrew Pinski <apinski@marvell.com>
> 
> The problem here is arc looks at current_output_insn unconditional
> but sometimes current_output_insn is NULL.  With patchable-function-entry,
> it will be. This is similar to how the nios2, handles "%.".
> 
> Committed as obvious after a simple test with -fpatchable-function-entry=1.
I almost did this myself, but just didn't feel comfortable ;-)

jeff
>
diff mbox series

Patch

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 07e7356..55b2392 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@ 
+2020-01-22  Andrew Pinski  <apinski@marvell.com>
+
+	* config/arc/arc.c (output_short_suffix): Check insn for nullness.
+
 2020-01-22  David Malcolm  <dmalcolm@redhat.com>
 
 	PR analyzer/93307
diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
index 02ab339..22475f2 100644
--- a/gcc/config/arc/arc.c
+++ b/gcc/config/arc/arc.c
@@ -5537,6 +5537,8 @@  static void
 output_short_suffix (FILE *file)
 {
   rtx_insn *insn = current_output_insn;
+  if (!insn)
+    return;
 
   if (arc_verify_short (insn, cfun->machine->unalign, 1))
     {