#68 Unhandled C error leading to weird Cabs2cil message

Bug
closed-fixed
nobody
5
2007-05-15
2007-05-08
David Gay
No

The following code:
double sqrt(double y);

int *f(int *x)
{
x += sqrt(4);
return x;
}

gives an unpleasant Cabs2cil message:
owl@ivydbg:~/ivy/ucb-projects/freeze$ ccount --out=/dev/tty cilbug1.c

cilbug1.c:5: Error: doBinOp: PlusA(Lval(Var(x, NoOffset)),
Lval(Var(tmp, NoOffset)))

error in doExp (Errormsg.Error)

Error: Cabs2cil had some errors

The code is incorrect, but it's not a very nice way of warning the user...
owl@ivydbg:~/ivy/ucb-projects/freeze$ gcc -c cilbug1.c
cilbug1.c: In function âfâ:
cilbug1.c:5: error: invalid operands to binary +

Discussion

  • Matt Harren

    Matt Harren - 2007-05-15
    • status: open --> closed-fixed
     
  • Matt Harren

    Matt Harren - 2007-05-15

    Logged In: YES
    user_id=1278428
    Originator: NO

    I added a slightly better error message (similar to gcc's).

    (Standard disclaimer: CIL does not attempt to give good error messages/warnings for code that doesn't pass gcc.)

    Thanks,
    Matt

     

Log in to post a comment.

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

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks