From: SourceForge.net <no...@so...> - 2004-08-12 11:39:06
|
Bugs item #1007371, was opened at 2004-08-11 08:31 Message generated for change (Comment added) made by nobody You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=1007371&group_id=599 Category: Live range problems Group: fixed Status: Closed Resolution: Fixed Priority: 5 Submitted By: Nobody/Anonymous (nobody) Assigned to: Erik Petrich (epetrich) Summary: sdcc optimizator bug Initial Comment: I has found bug in SDCC: Source: #include <8051.h> //Процедуры связи с PC void conout(unsigned char chr) { SBUF=chr; loop: if (TI==0) goto loop; TI=0; } //Вывод строки символов в UART void string_out(code unsigned char * data adr) { code unsigned char * data uk; unsigned char symb; uk= adr; loop: symb=*uk; uk++; if (symb!=0) { conout(symb); goto loop; } } void main(void) { } SDCC run command: sdcc --verbose --model-small --peep-asm -mmcs51 -- iram-size 128 --xram-size 0 --code-size 4096 -- nojtbound test.c SDCC version: SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51 /ds400/hc08 2.4.3 #792 (Aug 10 2004) (MINGW32) Asm list: 335 ;------------------------------ ------------------------------ 336 ;Allocation info for local variables in function 'string_out' 337 ;------------------------------ ------------------------------ 338 ;adr Allocated to registers r2 r3 339 ;uk Allocated to registers r2 r3 340 ;symb Allocated to registers r4 341 ;------------------------------ ------------------------------ 342 ;test.c:13: void string_out (code unsigned char * data adr) 343 ; --------------------------- -------------- 344 ; function string_out 345 ; --------------------------- -------------- 003A 346 _string_out: 347 ; genReceive 003A AA 82 348 mov r2,dpl 003C AB 83 349 mov r3,dph 350 ;test.c:18: loop: 351 ; genAssign 003E 352 00101 $: <= Loop position 353 ;test.c:19: symb=*uk; 354 ; genPointerGet 355 ; genCodePointerGet 003E 8A 82 356 mov dpl,r2 0040 8B 83 357 mov dph,r3 0042 E4 358 clr a 0043 93 359 movc a,@a+dptr 0044 FC 360 mov r4,a <= Assign var to R4 0045 A3 361 inc dptr 0046 AA 82 362 mov r2,dpl 0048 AB 83 363 mov r3,dph 364 ;test.c:20: uk++; 365 ;test.c:21: if (symb!=0) 366 ; genCmpEq 004A BC 00 01 367 cjne r4,#0x00,00108$ <= Check var 368 ; Peephole 112.b changed ljmp to sjmp 369 ; Peephole 251.b replaced sjmp to ret with ret 004D 22 370 ret 004E 371 00108$: 372 ;test.c:23: conout(symb); 373 ; genCall 004E 8C 82 374 mov dpl,r4 <= Final use var 0050 C0 02 375 push ar2 0052 C0 03 376 push ar3 0054 C0 04 377 push ar4 <= Waste Push operation 0056 12s00r31 378 lcall _conout 0059 D0 04 379 pop ar4 <= Waste Pop Operation 005B D0 03 380 pop ar3 005D D0 02 381 pop ar2 382 ;test.c:24: goto loop; 383 ; Peephole 112.b changed ljmp to sjmp 005F 80 DD 384 sjmp 00101$ 0061 385 00104$: 0061 22 386 ret In the old sdcc versions this error not exists. With the best wishes, Ruslan. My e-mail: Ru...@hi... ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2004-08-12 04:39 Message: Logged In: NO To Maarten Brock: Latest version without such bug is SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds40 0/hc08 2.4.3 #785 (Aug 4 2004) (MINGW32) With the best wishes, Ruslan. My e-mail: Ru...@hi... ---------------------------------------------------------------------- Comment By: Erik Petrich (epetrich) Date: 2004-08-11 21:50 Message: Logged In: YES user_id=635249 Fixed in SDCClrange.c 1.39. ---------------------------------------------------------------------- Comment By: Maarten Brock (maartenbrock) Date: 2004-08-11 12:46 Message: Logged In: YES user_id=888171 Could you please be more specific which older version you're referring to? Preferrably the latest that doesn't produce this little less efficient optimization? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=1007371&group_id=599 |