Bugs item #1597044, was opened at 2006-11-15 15:05
Message generated for change (Comment added) made by tecodev
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100599&aid=1597044&group_id=599
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: pic14 target
>Group: fixed
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Max Ben (maxben65)
Assigned to: Nobody/Anonymous (nobody)
Summary: Compile error in PIC14 (optimization error?)
Initial Comment:
When I try to compile the program listed below, I see that some instruction are eliminated by the assembly code.
(sorry for my little english!!)
Max.
sdcc -v
SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08 2.6.1 #4
471 (Nov 14 2006) (MINGW32)
sdcc -V -S -mpic14 test1.c
test1.c
-------
/* Test program */
#include <pic12f675.h>
unsigned char i,j,k;
void proc_1( void )
{
unsigned char h;
if (!i) {
k |= 0x01;
}
else {
i--;
h = i & 0x07; // ** This instruction is ignored!!
if (h) { // ** This condition is ignored!!!!
j++;
}
}
}
void main( void )
{
i = 0x50;
j = 100;
k = 0;
proc_1();
}
test1.asm (output of compilation)
---------------------------------
(only function "proc_1()")
::::::::::::
;; Starting pCode block
_proc_1 ;Function start
; 2 exit points
; .line 11; "test1.c" if (!i) {
MOVLW 0x00
BANKSEL _i
IORWF _i,W
BANKSEL STATUS
BTFSS STATUS,2
GOTO _00108_DS_
; .line 12; "test1.c" k |= 0x01;
BANKSEL _k
BSF _k,0
GOTO _00110_DS_
_00108_DS_
; .line 15; "test1.c" i--;
BANKSEL _i
DECF _i,F
; .line 19; "test1.c" j++;
BANKSEL _j
INCF _j,F
_00110_DS_
RETURN
; exit point of _proc_1
::::::::::::
???? Where is the code for
h = i & 0x07;
if (h) {
I try to compile "if (i & 0x07) {" instead of the
above lines, bat the result is the same.
----------------------------------------------------------------------
>Comment By: Raphael Neider (tecodev)
Date: 2006-11-20 23:24
Message:
Logged In: YES
user_id=1115835
Originator: NO
Fixed in SDCC r4474.
Both versions (if (h) and if (i & 0x07)) should now work.
Actually, this was no optimization error---the code generator is simply
incomplete: the required part was implemented as a stub.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100599&aid=1597044&group_id=599
|