gnupic: sdcc bug


Previous by date: 14 Oct 2002 16:59:49 -0000 gputils-0.10.4, Craig Franklin
Next by date: 14 Oct 2002 16:59:49 -0000 sdcc bug (rigth posting, previous got sent incomplete), Ricardo Amezquita Orozco
Previous in thread:
Next in thread: 14 Oct 2002 16:59:49 -0000 Re: sdcc bug, Samuel Tardieu

Subject: sdcc bug
From: "Ricardo Amezquita Orozco" ####@####.####
Date: 14 Oct 2002 16:59:49 -0000
Message-Id: <ILINENHPILOCIAAA@mailcity.com>

Hello

I wrote a small program, to test some things in the pic port of the sdcc compiler, and I think I found a bug.

The C source is the folowing

#include "p16f877.h"
#define __16F877
BIT_AT (PORTA_ADDR,0)  PA;
BIT_AT (PORTB_ADDR,0)  PB;

int main()
{
  int i;
  int j;
  
  TRISB=255;
  ADCON1=0x06;
  TRISA=0x00;
  while(1)
    {
      if(PB==0)PA=1;
      else PA=0;
  
    }
  
}

the generated asm is the following
.......
;; Starting pCode block
_main	;Function start
; 2 exit points
;#CSRC	test.c 11
;  TRISB=255;
	MOVLW	0xff
	BSF	_STATUS,5 # change to bank 1
	MOVWF	_TRISB
;#CSRC	test.c 12
;  ADCON1=0x06;
	MOVLW	0x06
	MOVWF	_ADCON1
;#CSRC	test.c 13
;  TRISA=0x00;
	CLRF	_TRISA
_00109_DS_
;#CSRC	test.c 14
;  while(1)
	BTFSC	(_PB >> 3), (_PB & 7) # still in bank 1 but pb is in bank 0
	GOTO	_00106_DS_
	BCF	_STATUS,5
;#CSRC	test.c 16
;  if(PB==0)PA=1;
	BSF	(_PA >> 3), (_PA & 7)
	GOTO	_00109_DS_
_00106_DS_
;#CSRC	test.c 17
;  else PA=0;
	BCF	(_PA >> 3), (_PA & 7)
	GOTO	_00109_DS_
	RETURN	
; exit point of _main
	end

The asm file is triying to check if PB==0 in the wrong bank



____________________________________________________________
Watch a championship game with Elway or McGwire.
Enter Now at http://champions.lycos.com 

Previous by date: 14 Oct 2002 16:59:49 -0000 gputils-0.10.4, Craig Franklin
Next by date: 14 Oct 2002 16:59:49 -0000 sdcc bug (rigth posting, previous got sent incomplete), Ricardo Amezquita Orozco
Previous in thread:
Next in thread: 14 Oct 2002 16:59:49 -0000 Re: sdcc bug, Samuel Tardieu


Powered by ezmlm-browse 0.20.