#421 sdcc: bug in array declaration - fixed

closed
nobody
None
5
2013-05-25
2002-12-14
Anonymous
No

sorry to my english
pass@i.com.ua

sdcc 2.3.0

if you try to compile this fragment

char test[(10>5)?10:5];

you'll get

error *** Constant Expected Found Variable
Segmentation fault.

patch:
file SDCCast.c

function constExprValue:

if (IS_AST_VALUE (cexpr))
return cexpr->opval.val;

+ if (IS_TERNARY_OP(cexpr) && IS_COLON_OP(cexpr-
>right)){
+ if(((int)floatFromVal(cexpr->left->opval.val)))
+ return constExprValue(cexpr->right-
>left,TRUE);
+ else
+ return constExprValue(cexpr->right-
>right,TRUE);
+ }

if (check){
werror (E_CONST_EXPECTED, "found
expression");
}

Discussion

  • Jesus Calvino-Fraga

    • status: open --> closed
     
  • Jesus Calvino-Fraga

    Logged In: YES
    user_id=603650

    This can't be reproduced in 2.3.2. Can you confirm it still
    exists?

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks