CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

PCH problem with *ptr++ = '0' + (*ptr);

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Joe Porthouse



Joined: 21 Sep 2003
Posts: 8
Location: orlando, FL

View user's profile Send private message Visit poster's website

PCH problem with *ptr++ = '0' + (*ptr);
PostPosted: Mon Feb 28, 2005 12:10 pm     Reply with quote

PCH seems to have a hard time with expressions that reference a pointer, assign to the same pointer and increment the pointer.

*ptr++ = '0' + (*ptr);
While this does increment ptr correctly, it seems to assign a random value to *ptr first.

*ptr = '0' + (*ptr);
ptr++;
This works correctly.

(from the listing file)
CCS PCH C Compiler, Version 3.219, 27671 28-Feb-05 13:01

.................... *ptr++ = '0' + (*ptr);
1CC6: MOVFF 148,03
1CCA: MOVF x47,W
1CCC: INCF x47,F
1CCE: BTFSC FD8.2
1CD0: INCF x48,F
1CD2: MOVWF x4E
1CD4: MOVFF 03,14F
1CD8: MOVFF 147,FE9
1CDC: MOVFF 148,FEA
1CE0: MOVF FEF,W
1CE2: ADDLW 30
1CE4: MOVWF x50
1CE6: MOVFF 14F,FEA
1CEA: MOVFF 14E,FE9
1CEE: MOVFF 150,FEF

.................... *ptr = '0' + (*ptr);
1D82: MOVFF 147,FE9
1D86: MOVFF 148,FEA
1D8A: MOVF FEF,W
1D8C: ADDLW 30
1D8E: MOVWF x50
1D90: MOVFF 148,FEA
1D94: MOVFF 147,FE9
1D98: MOVFF 150,FEF
.................... ptr++;
1D9C: INCF x47,F
1D9E: BTFSC FD8.2
1DA0: INCF x48,F
rwyoung



Joined: 12 Nov 2003
Posts: 563
Location: Lawrence, KS USA

View user's profile Send private message Send e-mail

PostPosted: Mon Feb 28, 2005 2:40 pm     Reply with quote

Did you let techsupport at CCS know? I think they only log bugs sent directly to them and generally NOT those posted on the forum.
_________________
Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
Joe Porthouse



Joined: 21 Sep 2003
Posts: 8
Location: orlando, FL

View user's profile Send private message Visit poster's website

PostPosted: Mon Feb 28, 2005 7:29 pm     Reply with quote

I didn't know that. I just sent my post on to CCS. Thanks...
Guest








PostPosted: Thu Mar 03, 2005 7:24 pm     Reply with quote

Joe Porthouse wrote:
I didn't know that. I just sent my post on to CCS. Thanks...


Is it fixed in 3.221 ?
Joe Porthouse



Joined: 21 Sep 2003
Posts: 8
Location: orlando, FL

View user's profile Send private message Visit poster's website

PostPosted: Thu Mar 03, 2005 8:50 pm     Reply with quote

I would guess not. I received the following from CCS Support.

"The problem has been confirmed. We evaluate the right side of the = before the left side even though you have ( ) on the left side. It is added to our to-fix list but it may be a couple months before a fix is in."

BTW, looking at "*ptr++ = '0' + (*ptr);" I believe they accidentally switched left and right in their response.
Darren Rook



Joined: 06 Sep 2003
Posts: 287
Location: Milwaukee, WI

View user's profile Send private message Send e-mail

PostPosted: Thu Mar 03, 2005 10:47 pm     Reply with quote

I doubt it will be a couple of months, I am surpised someone gave you that response.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group