View previous topic :: View next topic |
Author |
Message |
Joe Porthouse
Joined: 21 Sep 2003 Posts: 8 Location: orlando, FL
|
PCH problem with *ptr++ = '0' + (*ptr); |
Posted: Mon Feb 28, 2005 12:10 pm |
|
|
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
|
|
Posted: Mon Feb 28, 2005 2:40 pm |
|
|
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
|
|
Posted: Mon Feb 28, 2005 7:29 pm |
|
|
I didn't know that. I just sent my post on to CCS. Thanks... |
|
|
Guest
|
|
Posted: Thu Mar 03, 2005 7:24 pm |
|
|
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
|
|
Posted: Thu Mar 03, 2005 8:50 pm |
|
|
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
|
|
Posted: Thu Mar 03, 2005 10:47 pm |
|
|
I doubt it will be a couple of months, I am surpised someone gave you that response. |
|
|
|