Menu

#3264 Constant parameter leads to bogus compilation error

closed-fixed
None
other
5
2021-07-12
2021-07-10
No

The following code fails to compile with SDCC 4.1 due to a bogus compilation error:

static inline int f(const int x) {
    return x;
}

static inline void g(void) {
    f(0);
}

void main(void) {
    g();
}

Output:

$ sdcc test.c
-:0: error 33: Attempt to assign value to a constant variable (=)

$ sdcc -v
SDCC : mcs51/z80/z180/r2k/r2ka/r3ka/gbz80/tlcs90/ez80_z80/z80n/ds390/pic16/pic14/TININative/ds400/hc08/s08/stm8/pdk13/pdk14/pdk15 4.1.0 #12072 (Linux)
published under GNU General Public License (GPL)

Discussion

  • Erik Petrich

    Erik Petrich - 2021-07-12
    • status: open --> closed-fixed
    • assigned_to: Erik Petrich
     
  • Erik Petrich

    Erik Petrich - 2021-07-12

    Fixed in [r12541]

     
  • Arseny Vakhrushev

    Thanks, Erik!

     

Log in to post a comment.

MongoDB Logo MongoDB