Menu

#2983 Bad pointer cast conversion

closed-fixed
None
Front-end
5
2023-01-26
2020-03-12
No

d:\Infocom\LED_clock\firmware\bug1>sdcc -v
SDCC : mcs51/z80/z180/r2k/r3ka/gbz80/tlcs90/ez80_z80/ds390/pic16/pic14/TININativ
e/ds400/hc08/s08/stm8/pdk13/pdk14/pdk15 4.0.0 #11528 (MINGW64)
published under GNU General Public License (GPL)

d:\Infocom\LED_clock\firmware\bug1>sdcc -mmcs51 --opt-code-size --model-small --
Werror --no-xinit-opt --std-sdcc99 -DPCB=PCB -DF_CPU=12000000 -c -E -o main.E~ m
ain.c

d:\Infocom\LED_clock\firmware\bug1>sdcc -mmcs51 --opt-code-size --model-small --
Werror --no-xinit-opt --std-sdcc99 -DPCB=PCB -DF_CPU=12000000 -c -o main.rel mai
n.c
Internal error: validateOpTypeConst failed in OP_VALUE(op) @ /home/sdcc-builder/
build/sdcc-build/orig/sdcc/src/SDCCicode.c:1156: expected value, got symbol

2 Attachments

Related

Bugs: #3020
Wiki: NGI0-Entrust-SDCC

Discussion

  • Philipp Klaus Krause

    • Category: MCS51 --> Front-end
     
  • Philipp Klaus Krause

    Slightly simplified code:

    typedef struct {
        unsigned int v0;
        unsigned int v1;
    } test_t;
    
    volatile unsigned char test=0;
    
    int main(void) {
        // get offset is ok
        unsigned int *t4=&((test_t *)0)->v1;
        test=(unsigned char)t4;
    
        // get offset is fail
        void *t6=(void *)&((test_t *)0)->v1;
        test=(unsigned char)t6;
    
        return 0;
    }
    

    This looks like a bug in the frontend, as it also fails for targets other than mcs51 (tried with stm8 and pdk14).

     
  • Philipp Klaus Krause

    I can still reproduce this in current [r13824].

     

    Related

    Commit: [r13824]

  • Philipp Klaus Krause

    • assigned_to: Philipp Klaus Krause
     
  • Philipp Klaus Krause

    • status: open --> closed-fixed
     
  • Philipp Klaus Krause

    Fixed in [r13825].

     

    Related

    Commit: [r13825]


Log in to post a comment.