Menu

#3717 "Compiler Internal Error" related to literal floating-point/integral promotion

closed-fixed
None
other
5
2024-03-23
2024-03-22
No

Compiling the following code using SDCC 4.4.0 results in a "FATAL Compiler Internal Error":

unsigned char foo(void) { return 0; } // Return type must be an unsigned char to reproduce bug
int func(float a) { return a; } // Argument type must be a float/double

void main(void)
{
    func(foo() + 0); // Summand literal must be 0 or a floating point (e.g. 1.0)
}

The console prompts used and output displayed were:

sdcc.exe -c -o "main.rel" "../main.c"
../main.c:6: error 9: FATAL Compiler Internal Error in file '/home/sdcc-builder/build/sdcc-build/orig/sdcc/src/SDCCopt.c' line number '312' : 0
Contact Author with source code
make: *** [main.rel] Error 1
Error code 2

Please note that the issue does not occur with SDCC 4.3.0.

Discussion

  • Philipp Klaus Krause

    I can reproduce the issue using current trunk on my Debian GNU/Linux testing system. --nogenconstprop is a workaround.

     
  • Philipp Klaus Krause

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

    Fixed in [r14739]. There is another, related issue that is not yet fixed: [bugs:#3718].

     

    Related

    Bugs: #3718
    Commit: [r14739]


    Last edit: Philipp Klaus Krause 2024-03-23

Log in to post a comment.

MongoDB Logo MongoDB