Jump to content
link87

Code Generation Error With Bit Shift And #defines

Recommended Posts

I've noticed the compiler seems to generate an error with constant expressions involving #defines that evaluate to 0.

 

The following code compiles fine:

#define ADC_SHIFT 0
sample >>= ADC_SHIFT;

 

This code produces an error:

#define ADC_SHIFT 1
sample >>= (ADC_SHIFT - 1);

 

Errors produced:

T:\test_dft\dft.c(181:9): internal error: failed to generate assignment expression

T:\test_dft\dft.c(181:9): error: failed to generate expression

 

This code also produces the same error:

#define ADC_SHIFT 1 - 1
sample >>= ADC_SHIFT;

 

This is with BoostC 6.91 running with -O2 targetted for the PIC18F1320.

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji 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...

×
×
  • Create New...