diff options
author | Daniel Cederman <cederman@gaisler.com> | 2017-12-19 08:04:52 +0000 |
---|---|---|
committer | Sebastian Huber <sh@gcc.gnu.org> | 2017-12-19 08:04:52 +0000 |
commit | a1eb62d35c16c354632ad1f7f3280f1c1021d7ee (patch) | |
tree | d95cd8535957692d6070d199de82ca39f8f8e59c /gcc | |
parent | f744bfec7ffb92b476da82bc62a81eaf087b2391 (diff) | |
download | gcc-a1eb62d35c16c354632ad1f7f3280f1c1021d7ee.zip gcc-a1eb62d35c16c354632ad1f7f3280f1c1021d7ee.tar.gz gcc-a1eb62d35c16c354632ad1f7f3280f1c1021d7ee.tar.bz2 |
SPARC: Make sure that jump is to a label in errata workaround
In some cases the jump could be to a return instruction and in those cases the
next_active_insn() function tries to follow an invalid pointer which leads to a
crash. This error did not manifest when using a 32-bit version of GCC which is
why I did not detect it before.
gcc/
* config/sparc/sparc.c (sparc_do_work_around_errata): Make sure
the jump is to a label.
From-SVN: r255807
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/config/sparc/sparc.c | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9c0419d..31a60f1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-12-19 Daniel Cederman <cederman@gaisler.com> + + * config/sparc/sparc.c (sparc_do_work_around_errata): Make sure + the jump is to a label. + 2017-12-19 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/83444 diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index c7c0bd8..288264f 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -1066,6 +1066,7 @@ sparc_do_work_around_errata (void) floating-point operation or a floating-point branch. */ if (sparc_fix_gr712rc && jump + && jump_to_label_p (jump) && get_attr_branch_type (jump) == BRANCH_TYPE_ICC) { rtx_insn *target = next_active_insn (JUMP_LABEL_AS_INSN (jump)); @@ -1085,7 +1086,7 @@ sparc_do_work_around_errata (void) && mem_ref (SET_SRC (set)) && REG_P (SET_DEST (set))) { - if (jump) + if (jump && jump_to_label_p (jump)) { rtx_insn *target = next_active_insn (JUMP_LABEL_AS_INSN (jump)); if (target && atomic_insn_for_leon3_p (target)) |