Hi, I've decided to update my mspgcc and I have compiled the 20120224 version (using Ubuntu 8.04). But I've noticed something strange, it appears that the compiler is generating incorrect assembly code. This is simple example:
void foo() { volatile int y = 1; } int dummy() { volatile int x = 0; return x; } int main(void) { if (dummy() == 1) { foo(); return 1; } return 0; } Compiling with " msp430-gcc -mmcu=msp430f1611 -O2 -fno-inline main.c", I get the following code for the main function: 0000403e <main>: 403e: b0 12 62 40 call #0x4062 4042: 1f 93 cmp #1, r15 ;r3 As==01 4044: 01 24 jz $+4 ;abs 0x4048 4046: 0f 43 clr r15 4048: b0 12 58 40 call #0x4058 404c: 1f 43 mov #1, r15 ;r3 As==01 0000404e <__stop_progExec__>: Notice how the second call is executed regardless if the jump is taken or not, which is incorrect. This causes foo() to be called even if dummy() does not return 1. Can anyone reproduce this issue? Is there a bug or I've messed up somewhere? I've just tested the Windows build and I get the same results. Thanks! Conrado ------------------------------------------------------------------------------ Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ _______________________________________________ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users