Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#1905 Incorrect code generation mcs51/large model

closed-fixed
Maarten Brock
5
2013-05-25
2012-01-06
Tony Hague
No

The attached code. when compiled with SDCC 3.0.0 or 3.1.0, using

sdcc --model-large eg.c

Generates incorrect code in the assembler output, specifically:

_read_shaft_i_1_1:
.ds 2

[snip]
eg.c:28: now = PCA1L;

mov _read_shaft_sloc0_1_0,_PCA1L
mov (_read_shaft_sloc0_1_0 >> 8),#0x00

since _read_shaft_sloc0_1_0 ends up at 0x0022, this corrupts 0x0000 (r0) with the high byte, rather than storing it at 0x0023

Discussion

  • Tony Hague
    Tony Hague
    2012-01-06

     
    Attachments
  • Tony Hague
    Tony Hague
    2012-01-06

    Slight oops - the 0x0022 refers to the full version this example came from - for the code provided it is located at 0x0008

     
  • Maarten Brock
    Maarten Brock
    2012-01-08

    • labels: --> Icode generator
    • milestone: --> fixed
    • assigned_to: nobody --> maartenbrock
    • status: open --> closed-fixed
     
  • Maarten Brock
    Maarten Brock
    2012-01-08

    Fixed in SDCC 3.1.1 #7186.