[Bug gas/16763] New: RL78 - Ranges of relative branches are not checked correctly

2014-03-27 Thread peper03 at yahoo dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=16763

Bug ID: 16763
   Summary: RL78 - Ranges of relative branches are not checked
correctly
   Product: binutils
   Version: 2.24
Status: NEW
  Severity: critical
  Priority: P2
 Component: gas
  Assignee: unassigned at sourceware dot org
  Reporter: peper03 at yahoo dot com

gas quietly allows out-of-range relative branches.  The RL78 processors allow
8-bit and 16-bit relative branches (so -128/+127 or -32768/+32767 bytes from
PC) but gas seems to be calculating the distance using unsigned values so it
will allow a forward jump of, say, 200 bytes without complaint that actually
ends up as a backwards jump of 56 bytes (i.e. -56).

A build-time error only occurs once the distance is too large to fit in an 8 or
16-bit value (as appropriate).

Backwards jumps are left for the linker to fix-up, so there's no error until
the linker runs (but at least there *is* a build-time error).

.list

.global _branchTest8
.global _branchTest16

_branchTest8:
br  $label8
.zero   200
br  $_branchTest8
label8:
ret

_branchTest16:
br  $label16
.zero   32769
br  $_branchTest16
label16:
ret

.end

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

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug gas/16763] RL78 - Ranges of relative branches are not checked correctly

2014-03-27 Thread peper03 at yahoo dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=16763

--- Comment #1 from Richard Hulme  ---
Sorry, typo in the 16-bit test:

.list

.global _branchTest8
.global _branchTest16

_branchTest8:
br  $label8
.zero   200
br  $_branchTest8
label8:
ret

_branchTest16:
br  $!label16
.zero   32769
br  $!_branchTest16
label16:
ret

.end

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

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils