bugGNU Development Chain for 68HC11/68HC12 - Bugs: bug #15493, Code generation problem on 68HC12

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #15493: Code generation problem on 68HC12

Submitter:  Stephane Carrez <ciceron>
Submitted:  Fri 20 Jan 2006 09:03:42 PM UTC
   
 
Category:  gcc Severity:  4 - Important
Item Group:  sw-bug Status:  Fixed
Privacy:  Public Assigned to:  ciceron
Open/Closed:  Closed

Sat 18 Feb 2006 09:47:53 PM UTC, comment #1: 

Fixed in release 3.1

Stephane Carrez <ciceron>
Group administrator
Fri 20 Jan 2006 09:03:42 PM UTC, original submission:  

If we compile the following code with:

m6811-elf-gcc -m68hc12 -S -Os b-2006-01-20.c -da -mshort

the generate code is wrong.  The following insn:

        xgdx
        stab    2,x
        xgdx
 
which corresponds to the RTL:

(insn:HI 19 17 21 0 0xb7fd72ec (set (mem/s/v:QI (plus:HI (reg/v/f:HI 2 y [54])
                (const_int 3 [0x3])) [0 <variable>.dirB+0 S1 A8])
        (reg:QI 2 y [54])) 30 {*movqi_68hc12} (nil)
    (nil))

is emitted.  It is wrong because of the xgdx.
Gcc emits this because reg 54 is 0 and the code wants
to clear the memory at 2,x.

typedef struct
{
   volatile unsigned char portA;
   volatile unsigned char  portB;
   volatile unsigned char  dirA;
   volatile unsigned char  dirB;
} MEBI_Regs;

void ReadExternalBus( unsigned int addr )
{
   MEBI_Regs mebi = (MEBI_Regs)0;

   // Write the address to the port A and B registers
   mebi->portB = addr;
   mebi->portA = addr>>8;

   // Change ports A and B to inputs
   mebi->dirA = 0;
   mebi->dirB = 0;
}

int main( void )
{
   ReadExternalBus( 0x1000 );
}

Stephane Carrez <ciceron>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

 

Follow 4 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2006-02-18 ciceron StatusConfirmed Fixed
    Open/ClosedOpen Closed
2006-01-20 ciceron StatusNone Confirmed
2006-01-20 ciceron Carbon-Copy- Added -email is unavailable-

Back to the top

Powered by Savane 3.13-cf05.
Corresponding source code