Jump to content
Sign in to follow this  
djulien

Boostc Comma Operator Broken

Recommended Posts

Bug description:

Some variations of the comma operator are broken in BoostC.

Description of how it should work:

http://en.wikipedia..../Comma_operator

http://en.wikipedia....n_C_and_C%2B%2B

 

Steps to reproduce:

example code:

 

   unsigned char a=1, b=2, c=3, i;

i = (a, ; //gives 2 syntax errors: "missing right paren" and "missing semicolon"

i = a, b;  //works okay: copies a to i and ignores b

i = (a += 2, a + ; //gives 2 syntax errors as above

i = a += 2, a + b;  //works okay except "-Oa" will drop the "+=2" part

i = a, b, c;   //works okay; copies a to i and ignores b and c

i = (a, b, c);  //gives 2 syntax errors as above

i = (a);  //works okay; copies a to i

i = (3);  //works okay; sets i to 3

i = a++, b+c, b++;   //works okay; copies a to i, then incs a and b; middle expr dropped

i = (a++, b+c, b++);   //gives 2 syntax errors as above

void func1(unsigned char param) { porta = param; }
func1((a));   //works okay; passes a to param

func1((a, );  //gives 2 syntax errors as above

 

Expected behaviour:

The main issue is to accept params around comma-separated expressions and then use the last value.

EDIT: should say "parens", not "params"

 

The second issue is to not optimize out side effects of comma-separated expressions under aggessive optimization

(see comments above)

 

Is the problem 100% reproduceable:

yes

 

Compiler:

BoostC

 

Compiler version:

7.10, 7.051, 7.04

 

Target device:

16F1827, '1823, '688

 

OS:

Windows XP

 

 

don

Edited by djulien
added CODE tags

Share this post


Link to post
Share on other sites

The problem has been fixed. Fix will be available in the next release. thanks for reporting.

 

Regards,

Pavel

Share this post


Link to post
Share on other sites

The problem has been fixed. Fix will be available in the next release. thanks for reporting.

 

Thanks! This will help to simplify my source code and improve its readability.

 

don

Share this post


Link to post
Share on other sites

Your content will need to be approved by a moderator

Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoticons maximum are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×