Menu

#3278 sdcc FATAL Compiler Internal Error

closed-fixed
None
STM8
5
2025-08-09
2021-09-08
OFreddy
No

description:
Compiling the attached code with sdcc produces a FATAL Compiler Internal Error:

main.c:644: error 9: FATAL Compiler Internal Error in file '/home/sdcc-builder/build/sdcc-build/orig/sdcc/src/stm8/peep.c' line number '89' : readint() got non-integer argument:
Contact Author with source code
A
A
A
A
A
A
A
A
A
A
A
A
A
A

command line:
sdcc -mstm8 -o "." --std-c99 -c "main.c"

sdcc version:
The fault occurs with sdcc Version V4.1.0 when using sdcc-4.1.0-x64-setup.exe on a windows 10 64-bit operating system. I have tested it against V3.6.0 which works fine without any issues.

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 (MINGW64)
published under GNU General Public License (GPL)
4 Attachments

Related

Wiki: NGI0-Commons-SDCC

Discussion

  • Philipp Klaus Krause

    I can reproduce the issue using current SDCC 4.1.10 #12685 on Debian GNU/Linux testing.

     
  • Philipp Klaus Krause

    The attached main-minimal.c reproduces the bug, and is much shorter than main.c.

     
  • Philipp Klaus Krause

    Looks like the issue is triggered by the use of upper-case for the inline assembler code in STARTUP_SWIM_DELAY_5S followed by a function call for which tail-call optimization optimized a call/ret sequence to jmp.

     
  • Philipp Klaus Krause

    Self-contained sample to reproduce (the issue still exists in current trunk):

    #define STARTUP_SWIM_DELAY_5S \
    { \
    __asm PUSHW X \
    PUSH A \
    LDW X, #0xFFFF \
    loop1: LD A, #50 \
    \
    loop2: DEC A \
    JRNE loop2 \
    \
    DECW X \
    JRNE loop1 \
    \
    POP A \
    POPW X \
    __endasm; }
    
    void TIMER_Config(void);
    
    void main(void)
    {
        STARTUP_SWIM_DELAY_5S;
    
        TIMER_Config();
    }
    
     
  • Philipp Klaus Krause

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

    Fixed in [r15573].

     

    Related

    Commit: [r15573]


Log in to post a comment.

MongoDB Logo MongoDB