From: Gál Z. <tra...@fr...> - 2012-12-31 08:28:12
|
I can confirm this problem with my experince. I found that the problem takes place when the "magic" number is an even number between 0x102 and 0x1FE. I didn't find problem with 0x100 and less or with 0x200 and more. I didn't make test with all of the number from 0 - 0xFFFF, only just few around 0x100,0x200,0x300,0x700. ; File Created by SDCC : free open source ANSI-C Compiler ; Version 3.2.1 #8235 (Dec 15 2012) (Linux) ; This file was generated Mon Dec 31 09:19:13 2012 I used this command for compiling: sdcc -mpic14 -p16f887 -V --debug -I/home/zsolti/Fejlesztes/PIC_Programok/PIC16F/sdcc_teszt/c_teszt/ -c disappear.c --use-non-free --verbose --nogcse --no-pcode-opt --noinvariant --no-peep --noinduction --nooverlay --nolabelopt --nojtbound --noloopreverse It looks like that command line options according optimizations doesn't solved the problem. I made a little modification also on the source, but it didn't help, so the problem still exists: #include"pic16f887.h" void main() { int i, temp = 0; for (i=0 ;i<10; i++) { temp += ( int )0x1FE; // this will be disappear magically. // I mean the number 0x102 will NOT be added to the temp. // if the number is other besides 0x102, everything is all right PORTA = temp; // I konwn only the low 8 bit will be used. } } |