http://sourceware.org/bugzilla/show_bug.cgi?id=12269

           Summary: unknown-z80-coff: Incorrect assembly of indexed
                    register offsets from equ declarations
           Product: binutils
           Version: unspecified
            Status: NEW
          Severity: critical
          Priority: P2
         Component: gas
        AssignedTo: unassig...@sources.redhat.com
        ReportedBy: chris.smit...@googlemail.com


For the target unknown-z80-coff, Indexed register offsets are incorrectly
assembled as zero if they reference an equ declarations that has yet to be
made. Providing the equ declaration first in the file produces the correct
offset.

This produces incorrect executables from correct Z80 source.

Other uses of the equ value appear to assemble correctly (LD A, offsetAtEnd for
example below).


Example code and dump illustrating the problem:
-------------------------------------------------------------------------
begin:

offsetAtStart:    equ   32

            LD    A, offsetAtStart
            LD    A, (IX + offsetAtStart)

            LD    A, offsetAtEnd
            LD    A, (IX + offsetAtEnd)

            RET

offsetAtEnd:      equ   64
            END


This produces the following (note the 00 offset at line 10 - should be 0x40 as
in line 9)

   1                    begin:
   2
   3                    offsetAtStart:    equ   32
   5                    
   6 0000 3E20                      LD    A, offsetAtStart
   7 0002 DD7E 20                   LD    A, (IX + offsetAtStart)
   8                    
   9 0005 3E40                      LD    A, offsetAtEnd
  10 0007 DD7E 00                   LD    A, (IX + offsetAtEnd)
  11                    
  12 000a C9                        RET
  13                    
  14                    offsetAtEnd:      equ   64

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to