#882 conditional operator types

closed-fixed
Maarten Brock
5
2013-05-25
2005-02-17
Ant.M.
No

char a, *p, *q="abc", *r="def";

void test(void)
{
p=(a ? q : r); /* OK */
p=(a ? "abc" : "def"); /* OK */
p=(a ? q : "def"); /* OK */
p=(a ? "abc" : r); /* FAIL */
}

/* command : sdcc -c -mz80 -o bug1.o bug1.c */

/* bug1.c:8: error: indirections to different types
conditional operator */

/* SDCC :
mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51
/ds400/hc08 2.4.0 (Feb 23 2004) (MINGW32) */

When this appears in more complex code, SDCC may
then bomb out with the error:
Assertion failed: IS_COLON_OP (tree->right), file
SDCCcast.c, line 3832

Discussion

  • Maarten Brock
    Maarten Brock
    2005-02-17

    • labels: --> C-Front End
    • status: open --> open-accepted
     
  • Maarten Brock
    Maarten Brock
    2005-02-17

    Logged In: YES
    user_id=888171

    This is not bound to the z80 port. And it still exists in 2.4.8.

     
  • Maarten Brock
    Maarten Brock
    2005-02-22

    • milestone: --> fixed
    • assigned_to: nobody --> maartenbrock
    • status: open-accepted --> closed-fixed
     
  • Maarten Brock
    Maarten Brock
    2005-02-22

    Logged In: YES
    user_id=888171

    Fixed in SDCC 2.4.8 #964