mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-28 07:50:20 +02:00
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.
This commit is contained in:
parent
763b1f87e7
commit
ffba9b08c4
1 changed files with 10 additions and 3 deletions
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue