#596 Internal Error when the switch arg is a constant

closed-fixed
nobody
None
5
2013-05-25
2003-09-29
Stas Sergeev
No

Hi.

The following program (attached), compilled with the
newest sdcc from CVS, gives an Internal Error message.

$ sdcc -mmcs51 --nojtbound int_err.c
Internal error: validateOpType failed in
OP_USES(IC_JTCOND (ic)) @ SDCCcse.c:1740: expected
symbol, got value

Program:
---
int main()
{
switch (2) {
case 3: return 3;
case 2: return 2;
case 1: return 1;
}
return 0;
}
---

This is a just another "educational" bug, i.e. the
severity is nearly zero, but is probably worth fixing
anyway:)

Discussion

  • Stas Sergeev
    Stas Sergeev
    2003-09-29

    test-case

     
    Attachments
  • Bernhard Held
    Bernhard Held
    2003-09-30

    Logged In: YES
    user_id=203539

    The internal error is fixed in SDCCcse.c 1.84. But there are
    still 2 errors "Initializer element is not constant".

     
  • Erik Petrich
    Erik Petrich
    2003-10-01

    Logged In: YES
    user_id=635249

    Completed fix in src/SDCCicode.c 1.168

    ("Initializer element is not constant" was a result of
    attempting to use setOperandType (cond, UCHARTYPE) when cond
    was literal, leaving it with a type but no value)

     
  • Erik Petrich
    Erik Petrich
    2003-10-01

    • milestone: --> fixed
    • status: open --> closed-fixed
     
  • Stas Sergeev
    Stas Sergeev
    2003-10-02

    Logged In: YES
    user_id=501371

    Just confirming that it is now working.
    Thanks guys.