[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 01/07: Fix undefined behavior in ARMv7 assembler
From: |
Andy Wingo |
Subject: |
[Guile-commits] 01/07: Fix undefined behavior in ARMv7 assembler |
Date: |
Fri, 19 Jun 2020 10:32:51 -0400 (EDT) |
wingo pushed a commit to branch master
in repository guile.
commit ffba9b08c471568f1d7e24a0cae889a954cae515
Author: Andy Wingo <wingo@igalia.com>
AuthorDate: Fri Jun 19 16:14:52 2020 +0200
Fix undefined behavior in ARMv7 assembler
* lightening/arm-cpu.c (rotate_left): Fix the case of rotating by zero,
which produced undefined behavior. Many thanks to Andrew
Gierth (andrew at tao11 riddles org uk) for the debugging and the
fix.
---
lightening/arm-cpu.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/lightening/arm-cpu.c b/lightening/arm-cpu.c
index d96d57b..39123c7 100644
--- a/lightening/arm-cpu.c
+++ b/lightening/arm-cpu.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012-2017, 2019 Free Software Foundation, Inc.
+ * Copyright (C) 2012-2017,2019-2020 Free Software Foundation, Inc.
*
* This file is part of GNU lightning.
*
@@ -193,8 +193,15 @@ emit_wide_thumb(jit_state_t *_jit, uint32_t inst)
emit_u16_with_pool(_jit, inst & 0xffff);
}
-/* from binutils */
-# define rotate_left(v, n) (v << n | v >> (32 - n))
+static uint32_t
+rotate_left(uint32_t v, uint32_t n) {
+ if (n == 0) {
+ return v;
+ }
+ ASSERT(n < 32);
+ return (v << n | v >> (32 - n));
+}
+
static int
encode_arm_immediate(unsigned int v)
{
- [Guile-commits] branch master updated (a0b9d86 -> 52baa45), Andy Wingo, 2020/06/19
- [Guile-commits] 01/07: Fix undefined behavior in ARMv7 assembler,
Andy Wingo <=
- [Guile-commits] 02/07: Merge branch 'fix-rotate-by-zero' into 'master', Andy Wingo, 2020/06/19
- [Guile-commits] 03/07: Fix zeroing of literal pool entries, Andy Wingo, 2020/06/19
- [Guile-commits] 04/07: Merge branch 'fix-literal-pool-reset' into 'master', Andy Wingo, 2020/06/19
- [Guile-commits] 07/07: Merge upstream 'lightening', Andy Wingo, 2020/06/19
- [Guile-commits] 05/07: Merge upstream 'lightening', Andy Wingo, 2020/06/19
- [Guile-commits] 06/07: Fix unused variable warning for no-literal-pool targets, Andy Wingo, 2020/06/19