mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-09-09 17:02:22 +08:00
* cgen-ibld.in (insert_normal): Cope with attempts to insert a signed 32-bit
value into an unsigned 32-bit field when the host is a 64-bit machine.
This commit is contained in:
@ -168,13 +168,21 @@ insert_normal (CGEN_CPU_DESC cd,
|
||||
else if (! CGEN_BOOL_ATTR (attrs, CGEN_IFLD_SIGNED))
|
||||
{
|
||||
unsigned long maxval = mask;
|
||||
|
||||
if ((unsigned long) value > maxval)
|
||||
unsigned long val = (unsigned long) value;
|
||||
|
||||
/* For hosts with a word size > 32 check to see if value has been sign
|
||||
extended beyond 32 bits. If so then ignore these higher sign bits
|
||||
as the user is attempting to store a 32-bit signed value into an
|
||||
unsigned 32-bit field which is allowed. */
|
||||
if (sizeof (unsigned long) > 4 && ((value >> 32) == -1))
|
||||
val &= 0xFFFFFFFF;
|
||||
|
||||
if (val > maxval)
|
||||
{
|
||||
/* xgettext:c-format */
|
||||
sprintf (errbuf,
|
||||
_("operand out of range (%lu not between 0 and %lu)"),
|
||||
value, maxval);
|
||||
_("operand out of range (0x%lx not between 0 and 0x%lx)"),
|
||||
val, maxval);
|
||||
return errbuf;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user