bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gas/25184] New: or1k gas errors on any backwards jump on 32-bit hos


From: bugdal at aerifal dot cx
Subject: [Bug gas/25184] New: or1k gas errors on any backwards jump on 32-bit host
Date: Mon, 11 Nov 2019 00:10:59 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=25184

            Bug ID: 25184
           Summary: or1k gas errors on any backwards jump on 32-bit host
           Product: binutils
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gas
          Assignee: unassigned at sourceware dot org
          Reporter: bugdal at aerifal dot cx
  Target Milestone: ---

I don't understand the lisp-like language the opcode C files are generated
from, so I don't have a root cause for this, but the problem is in
opcodes/or1k-ibld.c, or1k_cgen_insert_operand. For at least the DISP26 case,
and probably others, arithmetic that's logically signed is performed as
unsigned. On 64-bit hosts, prior unsigned arithmetic (long-bfd_vma, where
bfd_vma is unsigned long) has left 32 high 1 bits, so that unsigned right-shift
followed by truncation gives the right result. But on 32-bit hosts, the top two
bits end up zero, causing, for example, an offset of -8 to be interpreted as
0x3ffffff8, producing an "operand out of range" error.

Minimal test case:

1:      l.nop
        l.j 1b

There may also be integer overflows in insert_normal (1L shifted left up to 31
bits, I think) but these don't seem to be getting optimized in an unsafe manner
with the host compilers I've used.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]