Bug 5026 - Displaying Truncated Values Incorrectly
Summary: Displaying Truncated Values Incorrectly
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gas (show other bugs)
Version: 2.19
: P3 enhancement
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-12 20:01 UTC by Evandro
Modified: 2007-09-17 16:35 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed: 2007-09-16 00:41:05


Attachments
Suggested fix. (395 bytes, patch)
2007-09-12 20:03 UTC, Evandro
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Evandro 2007-09-12 20:01:56 UTC
When defining a constant too long for the size specified, the warning message
itself may truncate the original value on some platforms.

For example, this code:

.word   0x1234567890

On x86-64, GAS correctly displays:

****  Warning:value 0x1234567890 truncated to 0x7890

Whereas on x86, GAS displays:

****  Warning:value 0x34567890 truncated to 0x34567890

It should be easy to fix it by making sure that the longest integer is used (see
attachment).
Comment 1 Evandro 2007-09-12 20:03:08 UTC
Created attachment 2001 [details]
Suggested fix.

This fix should work for most platforms.
Comment 2 Evandro 2007-09-12 20:07:02 UTC
Ahem, on x86, GAS displays:

****  Warning:value 0x34567890 truncated to 0x7890
Comment 3 H.J. Lu 2007-09-15 20:58:00 UTC
The current binutils in CVS shows

[hjl@gnu-9 big-1]$ cat x.s
        .word   0x1234567890
[hjl@gnu-9 big-1]$ make
./as -o x.o x.s
x.s: Assembler messages:
x.s:1: Warning: bignum truncated to 2 bytes
[hjl@gnu-9 big-1]$

on Linux/i386.
Comment 4 Alan Modra 2007-09-16 00:40:40 UTC
HJ, I think you closed this bug too soon.  On a 32-bit host, binutils configured
with 64-bit bfd support will behave as reported.
Comment 5 Nick Clifton 2007-09-17 16:35:22 UTC
Hi Evandro,

  Thanks for the bug report and fix.  I have applied your suggested patch.

Cheers
  Nick