djulien 0 Report post Posted August 31, 2012 Bug description: The BoostC documentation says that "_asm" will remove dead code but "asm" will not (page 64). This does not appear to be the case - dead code is being removed with "asm" also. This is a problem because the "dead" code is actually needed. Example code: #include <system.h> unsigned char var1; inline void func(void) { asm //use asm block to prevent dead code removal { addwf _pcl, F; bcf _var1, 1; goto return2caller; nop; goto return2caller; bcf _var1, 2; goto return2caller; movlw 0x11; ; goto update; //problem line bcf _var1, 3; goto return2caller; bcf _var1, 4; goto return2caller; update: movwf _var1; return2caller: } } void main(void) { asm movf _var1, W; func(); } With the "problem line" commented out, the example code compiles and links correctly (no code is removed). However if the "problem line" is not commented out, the code will still compile but the linker will report the following error: Internal Error: Unable to resolve label ID:268438699 - 0x10000CAB BoostLink Optimizing Linker Version 7.10 It looks like it might have removed the section of code containing the "update" label, even though this was contained within the asm block (or maybe the linker is doing something else instead). Expected behavior: Linker should leave in the "update" label and "movwf", and not report an error. In either case, no "dead" code should be removed. Placing "#pragma OPTIMIZE "0"" ahead of func1 does not help either. Is the problem 100% reproduceable: yes Compiler: BoostC Compiler version: 7.10 Target device: PIC16F1827, etc. OS: Windows XP don Quote Share this post Link to post Share on other sites