Menu

#3516 SDCC Crash during compile with mismatch of __banked in forward declaration vs body of function

closed-fixed
Front-end
5
2024-05-06
2022-11-05
bbbbbr
No

SDCC sometimes crashes during compiling when the forward declaration for a function has the __banked keyword and the defined function body does not.

While the user should not declare them mismatched, it would be ideal for a warning to be emitted instead of a crash. Some variations of the example code do not produce the crash, this seems to be close to the minimum required.

Version (happens for windows build too, based on info from the reporting user)

sdcc -v
SDCC : z80/sm83/mos6502 4.2.2 #13350 (Linux)
published under GNU General Public License (GPL)
extern unsigned char some_var;

void some_function(unsigned char passedarg) __banked; 

void some_function(unsigned char passedarg) 
{
    switch (passedarg)
    {
        case 0: some_var = 1;
        break;  
    }   
}
sdcc -msm83 --no-std-crt0 --fsigned-char --use-stdout -D__PORT_sm83 -D__TARGET_gb  -DINT_16_BITS -c sdcc_crash.c -o sdcc_crash.o
Caught signal 11: SIGSEGV

Thanks!

Related

Wiki: NGI0-Entrust-SDCC

Discussion

  • bbbbbr

    bbbbbr - 2022-11-30

    Another user encountered this crash due to mismatched function header versus body declaration with the __banked keyword. In this scenario it was a stale header file that hadn't been updated.

    Since the compiler was crashing it was not immediately clear to them what the error was.

    error 9: FATAL Compiler Internal Error in file '/home/sdcc-builder/build/sdcc-build/orig/sdcc/src/z80/gen.c' line number '5782' : code generator internal error
    Contact Author with source code
    
     
  • Philipp Klaus Krause

    • status: open --> closed-fixed
    • assigned_to: Philipp Klaus Krause
    • Category: GBZ80 --> Front-end
     
  • Philipp Klaus Krause

    In [r13829], I made it an error for __banked to mismatch. I hope I didn't break someones use-case (I'm not really familiar with the __banked stuff).

     

    Related

    Commit: [r13829]

    • sverx

      sverx - 2024-05-06

      I think this has broken my use-case. Nothing tragic, I can probably fix that -- but I was wondering if there's some command line option to ignore this mismatch check instead?

       
  • bbbbbr

    bbbbbr - 2023-01-27

    Thank you!

     

Log in to post a comment.

MongoDB Logo MongoDB