davidb 0 Posted October 2, 2013 Report Share Posted October 2, 2013 Hi, SourceBoost 7.2 is still broken in regard to comparing signed data types with #defined constants with 18F parts. This is similar to the >= problem that occured in SourceBoost 7.1. which now seems to be fixed. Problem: The following test code was created to test for the problem. When compiled for 16F, specifically 16F887, it works fine with 'value' as any data type. When compiled for 18F parts, specifically 18F87K22, it works correctly for a signed char or signed long but fails using a signed short in test case 3. Expected Behaviour: To work correctly x should be 1 less than y at the end of the comparison loop for each test case. IDE: MPLAB V8.89Compiler: SourceBoost C V7.2Targets: Various 16F, 18FReproducible: 100%OS: XP Pro, Vista #include <system.h> static unsigned char x; static unsigned char y; static signed short value; static signed short variable_limit = -10; #define CONSTANT_LIMIT -10 void main() { for (; { /* TEST CASE 1 */ x = 0; y = 0; for (value = -20; value < 20; value++) { if (value > CONSTANT_LIMIT) // Works O.K. { x++; } if (value >= CONSTANT_LIMIT) // Works O.K. { y++; } } /* TEST CASE 2 */ x = 0; y = 0; for (value = -20; value < 20; value++) { if (value > variable_limit) // Works O.K. { x++; } if (value >= variable_limit) // Works O.K. { y++; } } /* TEST CASE 3 */ x = 0; y = 0; for (value = 20; value > -20; value--) { if (value < CONSTANT_LIMIT) // Works O.K. { x++; } if (value <= CONSTANT_LIMIT) // Fails with 18F parts { y++; } } /* TEST CASE 4 */ x = 0; y = 0; for (value = 20; value > -20; value--) { if (value < variable_limit) // Works O.K. { x++; } if (value <= variable_limit) // Works O.K. { y++; } } } } Regards davidb Quote Link to post Share on other sites
Pavel 0 Posted November 16, 2013 Report Share Posted November 16, 2013 This issue has been fixed. Fix will be available in the coming release 7.21 Regards, Pavel Quote Link to post Share on other sites
Recommended Posts
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.