robinfawell Posted September 16, 2006 Report Share Posted September 16, 2006 I get a compiler warning referring to the "switch (group)" line below."main.c:262:warning 110: conditional flow changed by optomizer: so said EVELYN to the modified DOG"Here is my code unsigned char group;//used for switch statement void DIN_NotifyToggle(unsigned char pin, unsigned char pin_value) __wparam { unsigned char stored_pin;void DIN_NotifyToggle(unsigned char pin, unsigned char pin_value) __wparamif (pin_value == 0){// only react when switch is pressed if ((pin >= 1) && (pin <= 5)) group = 1; if (pin == 7) group = 2; more code switch (group) {case (1) :{ { stored_pin = memory_group_stored_pin;// change value of stored pin to the memory group stored value stored_pin = SetLed_NoDump(1, 5, 9,stored_pin, pin, pin_value); //function, set pin_low to 0, pin_high to 5, canc_pin to 9 memory_group_stored_pin = stored_pin;//resets the variable for this group to the current stored pin after the function above. } break; //////////Record (Used with Memory Group) /////// case (2) : { stored_pin = record_button_state;// change value of stored pin to the memory group stored value stored_pin = SetLed_NoDump( 6, 6, 7,stored_pin, pin, pin_value);//see case 1 with pins changed record_button_state = stored_pin;//resets the variable for this group to the current stored pin after the function above. } break; I have had these warnings before and have solved them usually by supplying missing brackets.After a long seach on the web and can't find any useful reference to the statement. Also there must be a list of errors and warnings listed somewhere.Perhaps someone can point out the cause of the warning and point me to a source of error codes and warnings.Thank you.Robin Quote Link to comment Share on other sites More sharing options...
stryd_one Posted September 16, 2006 Report Share Posted September 16, 2006 Youve got two case 1's there mate ;) Quote Link to comment Share on other sites More sharing options...
robinfawell Posted September 16, 2006 Author Report Share Posted September 16, 2006 To Stryd OneSorry about the mistake. I have corrected the original post. I copied case 1 instead of showing case 1 and case2.RegardsRobin Quote Link to comment Share on other sites More sharing options...
audiocommander Posted September 16, 2006 Report Share Posted September 16, 2006 oh, I had that soo often too.This is a real beasty annoying warning. I remember I searched two days the first time I had such a warning; it can be really hard to track that down."Conditional flow changed by optimizer" means that SDCC finds something that can be optimized and changes the logic flow. The second line about Evelyn and the modified dog has been inserted by some funny programmer, it's from a song-lyric :)Looking at the code you provided, I suggest it may be somewhere here:[tt]if ((pin >= 1) && (pin <= 5)) group = 1; if (pin == 7) group = 2; more code[/tt]Maybe the problem is with an if coming right after an if; maybe that's confusing...If it helped in the past, perhaps it helps here, setting brackets, too?[tt]if ((pin >= 1) && (pin <= 5)) { group = 1; }if (pin == 7) { group = 2; // more code}[/tt]If that does not help, I recommend you take a look into the generated asm file, that's located in the "_output/" folder and search for "warning". This gives you a good impression where the error is located exactly. Maybe this helps pointing towards the problem.And if this does not help either: Can you add the line-numbers or make a screenshot, so we can see the codesnippet with line-numberings as it is in your file?Good luck!Best regards,Michael Quote Link to comment Share on other sites More sharing options...
robinfawell Posted September 16, 2006 Author Report Share Posted September 16, 2006 I moved on to other aspects and received other errors due to new code. However I thought that I would see if you were right about brackets on the first if statement.I commented out the new code that caused errors and compiled again. The was no warning 110. I then removed the brackets. Still no warning. I am bemused.It's possible of course, that I have changed something else.Thanks for your help again.Robin Quote Link to comment Share on other sites More sharing options...
wackazong Posted October 2, 2008 Report Share Posted October 2, 2008 For me, it helps seeing these == <> = errors (assign and logical compare are different signs). Since I am new to C, I always forget this convention, and EVELYN very often points me right to these cases :) Quote Link to comment Share on other sites More sharing options...
This N°9 Posted October 7, 2008 Report Share Posted October 7, 2008 if ((pin >= 1) && (pin <= 5)) group = 1; if (pin == 7) group = 2;maybe the optimizer changes this toif ((pin >= 1) && (pin <= 5)) group = 1;else if (pin == 7) group = 2;orif (pin >= 1){ if (pin == 7) group = 2; else if (pin <= 5) group = 1;}which would make sense. or it makes a switch construct out of it.check the sdcc-manual, it tells you something about flow changes. loops likefor($i=0;$i<8;$i++) ...will be reversed by the optimizer (topdown instead of bottom-up) when someconditions are given. this makes the condition check smaller. you get thesame flow-changed-warning then. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.