Menu

#2851 Operation order SDCC 3.8.0

open
nobody
None
PIC14
5
2018-12-13
2018-12-09
No
pos=0;
buf[pos++] = 1;

SDCC 3.6.0 gives buf[0] = 1 as result
SDCC 3.8.0 gives buf[1] = 1 as result

Discussion

  • Philipp Klaus Krause

    • Category: PIC14 --> other
     
  • Philipp Klaus Krause

    I tried to reproduce this using current SDCC [r10753] using the stm8 and pic14 backends, but couldn't. I tried:

    unsigned char pos, *buf;
    
    void f(void)
    {
      pos=0;
      buf[pos++] = 1;
    }
    

    Please provide a compileable reproducer for this issue.

    Philipp

     
  • Maarten Brock

    Maarten Brock - 2018-12-12
    • status: open --> pending-works-for-me
     
  • Maarten Brock

    Maarten Brock - 2018-12-12

    I have also tried mcs51 and could not reproduce.

     
  • Alexey Grachov

    Alexey Grachov - 2018-12-12

    Here is my code.
    Changes made in eeprom.c
    Build with build.sh
    Results (from top to bottom):

    1. sdcc 3.6.0 // ORIGINAL
    2. sdcc 3.8.0 // ORIGINAL
    3. sdcc 3.8.0 // FIRST
    4. sdcc 3.8.0 // FIRST + SECOND
     
  • Philipp Klaus Krause

    • status: pending-works-for-me --> open
     
  • Philipp Klaus Krause

    I can reproduce the issue in current SDCC. The issue also affects backends other than pic14 (I tried stm8).
    I have extracted the affected function into the attached file.

    Philipp

    P.S.: I made a mistake. The code for stm8, mcs51 and z80 looks good. I don't know about pic14.

     

    Last edit: Philipp Klaus Krause 2018-12-13
  • Philipp Klaus Krause

    • Category: other --> PIC14
     

Log in to post a comment.

Monday.com Logo