NetBSD-Bugs archive

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

toolchain/49273: 64-bit constant loads in as will be truncated to 32-bit.



>Number:         49273
>Category:       toolchain
>Synopsis:       64-bit constant loads in as will be truncated to 32-bit.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Oct 11 12:15:00 +0000 2014
>Originator:     Anders Magnusson
>Release:        6.1.5
>Organization:
>Environment:
NetBSD nbvax.tethuvudet.se 6.1.5 NetBSD 6.1.5 (GENERIC) vax
>Description:
movq of a small negative constant will be truncated to 32-bit.
For example, movq $-1,-(%sp) will create wrong code but movq $-88888888888,-(%sp) will work.


>How-To-Repeat:
nbvax:/home/ragge/pcc/cc/ccom >as
movq $-1,-(%sp)
movq $-20000000000,-(%sp)
movq $-2000000000,-(%sp)
nbvax:/home/ragge/pcc/cc/ccom >objdump -d a.out

a.out:     file format elf32-vax


Disassembly of section .text:

00000000 <.text>:
   0:   7d 8f ff ff     movq $0x00000000ffffffff,-(sp)  # wrong
   4:   ff ff 00 00 
   8:   00 00 7e 
   b:   7d 8f 00 38     movq $0xfffffffb57e83800,-(sp)  # correct
   f:   e8 57 fb ff 
  13:   ff ff 7e 
  16:   7d 8f 00 6c     movq $0x0000000088ca6c00,-(sp)  # wrong
  1a:   ca 88 00 00 
  1e:   00 00 7e 

>Fix:



Home | Main Index | Thread Index | Old Index