kevin@Lindy.STANFORD.EDU (Kevin Burnett) (11/04/87)
When compiling something with Mark Williams C, I got the following error message: 603: In cc1: Fatal error: Internal compiler error: FFFFA77E Here are lines 602 & 603: [602] while ( *p != ' ' && *p != '\t' && *p != '\n' && *p != '\0') [603] *p++; with the declaration: register char *p; Could someone tell me what's going on? I don't see anything wrong with the above bit of code... thanks.. -- Kevin Burnett Stanford Linear Accelerator Centre / Santa Clara Class of '88 Arpa: kevin@Lindy.Stanford.EDU Bitnet: KJBSF@SLACVM.BITNET Old-style UUCP: ...!decwrl!labrea!Lindy!kevin
ftw@datacube.UUCP (11/05/87)
kevin@Lindy.UUCP writes: > When compiling something with Mark Williams C, I got the following > error message: > 603: In cc1: Fatal error: Internal compiler error: FFFFA77E > Here are lines 602 & 603: > [602] while ( *p != ' ' && *p != '\t' && *p != '\n' && *p != '\0') > [603] *p++; > with the declaration: > register char *p; > Could someone tell me what's going on? I don't see anything wrong with > the above bit of code... What exactly do you want to do in line 603? It seems reasonable to assume you want to increment the pointer, which is what should happen given your code fragment. If this is the case, the extra indirection is not necessary. You can simply say: while (*p != ' ' ...) p++; If you *really* want to increment the thing pointed at by "p", then you must say either: while (*p != ' ' ...) (*p)++; /* ugly */ or: while (*p != ' ' ...) ++*p; The reason being that "++" has higher precedence than indirection ("*"), so in your example the _pointer_ is incremented, then dereferenced by "*". The compiler is probably confused because it expects some form of assignment to be taking place at about that point, as in "ch = *p++;" which increments "p", and assigns the thing now pointed at by "p" to "ch". Your line 603 is in error (semantically), but so is the compiler if it can't deal with that expression. The compiler should produce a diagnostic like "foo.c: 603: useless expression". The reason "++*p;" increments the thing pointed at by "p" is that "++" evaluates from right to left, and the expression on the right ("*p") is then evaluated. > thanks.. > -- > Kevin Burnett > Stanford Linear Accelerator Centre / Santa Clara Class of '88 > Arpa: kevin@Lindy.Stanford.EDU Bitnet: KJBSF@SLACVM.BITNET > Old-style UUCP: ...!decwrl!labrea!Lindy!kevin Your welcome! Farrell T. Woods Datacube Inc. Systems / Software Group 4 Dearborn Rd. Peabody, Ma 01960 VOICE: 617-535-6644; FAX: (617) 535-5643; TWX: (710) 347-0125 INTERNET: ftw@datacube.COM UUCP: {rutgers, ihnp4, mirror}!datacube!ftw
ftw@datacube.UUCP (11/06/87)
Allow me to respond to my not totally correct response BEFORE I get flamed too much ;-) For the record: In the original example, the expression: *p++ returns *p BEFORE the pointer is incremented, not after as I incorrectly stated at first. In my explanation: ch = *p++; then gets the value *p BEFORE p is incremented. I still stand by my remarks about the solutions to the original problem. Just want to set the record straight; the fingers were in motion this morning before the brain was fully engaged. Hadn't finished that first cup of coffee! My apologies... Farrell T. Woods Datacube Inc. Systems / Software Group 4 Dearborn Rd. Peabody, Ma 01960 VOICE: 617-535-6644; FAX: (617) 535-5643; TWX: (710) 347-0125 INTERNET: ftw@datacube.COM UUCP: {rutgers, ihnp4, mirror}!datacube!ftw
jdn@homxc.UUCP (11/09/87)
In article <105100026@datacube>, ftw@datacube.UUCP writes: > > kevin@Lindy.UUCP writes: > > > When compiling something with Mark Williams C, I got the following > > error message: > > > 603: In cc1: Fatal error: Internal compiler error: FFFFA77E > > > Here are lines 602 & 603: > > > [602] while ( *p != ' ' && *p != '\t' && *p != '\n' && *p != '\0') > > [603] *p++; > > > with the declaration: > > register char *p; > > > Could someone tell me what's going on? I don't see anything wrong with > > the above bit of code... > Farrel proceeds to give an explanation which is basically correct; however he makes the following oversight. > The compiler is probably confused because it expects some form of assignment > to be taking place at about that point, as in "ch = *p++;" which increments > "p", and assigns the thing now pointed at by "p" to "ch". Not so. This makes the assignment first, and then increments the pointer. Jonathan Nagy {ihnp4|allegra|harvard}!homxc!jdn (201) 615-4349