[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug gas/949] New: No relocation overflow error for 14 bit immediate val
From: |
hodaniel at student dot ethz dot ch |
Subject: |
[Bug gas/949] New: No relocation overflow error for 14 bit immediate values |
Date: |
12 May 2005 20:18:00 -0000 |
On sparc, instructions can hold a signed immediate value of 13 bits.
Valid values are in the range [-4096, 4095] but gas allows values in the range
[-8192, 8191] (= 14 bits).
Consider the following code sniplet:
------
.section ".rodata"
.align 8
outstr: .asciz "The Value is: %d\n"
.section ".text"
.align 4
.global main
main:
save %sp, -120, %sp
add %fp, -20, %o1
set outstr, %o0
mov %g0, %o1
add %o1, 8191, %o1 ! 8192 gives: immediate.s:14: Error: relocation
overflow
call printf, 0
nop
set outstr, %o0
mov %g0, %o1
add %o1, -8192, %o1 ! -8193 gives: immediate.s:20: Error: relocation
overflow
call printf, 0
nop
mov 0, %i0
nop
ret
restore
-----
It compiles without warnings or errors but the output is:
address@hidden:~/imm$ ./imm
The Value is: -1
The Value is: 0
Which suggests that the 14 bits which are necessary to hold the range [-8192,
8191] got truncated to 13 bits without warning.
FYI:
$ uname -a
SunOS rif23 5.9 Generic_117171-05 sun4u sparc
$ psrinfo -v
Status of processor 0 as of: 05/12/2005 22:14:40
Processor has been on-line since 05/12/2005 05:11:33.
The sparcv9 processor operates at 502 MHz,
and has a sparcv9 floating point processor.
$ as --version
GNU assembler 2.14 20030612
Copyright 2002 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License. This program has absolutely no warranty.
This assembler was configured for a target of `sparc-sun-solaris2.9'.
Hotti
--
Summary: No relocation overflow error for 14 bit immediate values
Product: binutils
Version: 2.14
Status: NEW
Severity: normal
Priority: P2
Component: gas
AssignedTo: unassigned at sources dot redhat dot com
ReportedBy: hodaniel at student dot ethz dot ch
CC: bug-binutils at gnu dot org
GCC host triplet: sparc-sun-solaris2.9
GCC target triplet: sparc-sun-solaris2.9
http://sources.redhat.com/bugzilla/show_bug.cgi?id=949
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
- [Bug gas/949] New: No relocation overflow error for 14 bit immediate values,
hodaniel at student dot ethz dot ch <=