From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,a6a2dd20dfd28b8a,start X-Google-Attributes: gidfee84,public From: Bill James Subject: Another C compiler problem Date: 1996/05/20 Message-ID: <31A04BCE.167E@lsl.co.uk> X-Deja-AN: 155722811 cc: bill@lsl.co.uk content-type: text/plain; charset=us-ascii organization: Laser-Scan Ltd. mime-version: 1.0 newsgroups: comp.unix.osf.osf1 x-mailer: Mozilla 2.0 (X11; I; OSF1 V3.2 alpha) We have another, distinct C compiler problem. The generated code seg faults at run-time, apparently due to an extraneous instruction in a common return sequence using 't12' - a temporary register. This is dUNIX V3.2C/D with OSFCMPLRS350/360. I have tried various optimisations, with and without debug, to no avail. OSFCMPLRS200 works, generating similar code, but without the offending instruction. Bad code: 0x120005d30 : 263dffff 9 ldah a1, -65536(gp) 0x120005d34 : 22317b10 8 lda a1, 31504(a1) 0x120005d38 : a77d8388 29 ldq t12, -31864(gp) 0x120005d3c : 6b5b7d9c 1a jsr ra, (t12), 0x1200053b0 0x120005d40 : 27ba2000 9 ldah gp, 536870912(ra) 0x120005d44 : 23bd4e90 8 lda gp, 20112(gp) ** Common return code ** 0x120005d48 : c3e00000 30 br zero, 0x120005d4c ** Silly instruction ** 0x120005d4c : a73be5b0 29 ldq t11, -6736(t12) ** 0x120005d50 : 275e0001 9 ldah ra, 65536(sp) 0x120005d54 : a75a09f0 29 ldq ra, 2544(ra) 0x120005d58 : 253e0001 9 ldah s0, 65536(sp) 0x120005d5c : a52909f8 29 ldq s0, 2552(s0) 0x120005d60 : 279e0001 9 ldah at, 65536(sp) 0x120005d64 : 23dc0a50 8 lda sp, 2640(at) 0x120005d68 : 6bfa8001 1a ret zero, (ra), 1 Good code from OSFCMPLRS200: 0x120005af0 : a6100000 29 ldq a0, 0(a0) 0x120005af4 : a63d8028 29 ldq a1, -32728(gp) 0x120005af8 : 223183d0 8 lda a1, -31792(a1) 0x120005afc : a77d8440 29 ldq t12, -31680(gp) 0x120005b00 : 6b5b6077 1a jsr ra, (t12), 0x11fffdce0 0x120005b04 : 27ba2000 9 ldah gp, 536870912(ra) 0x120005b08 : 23bd50cc 8 lda gp, 20684(gp) 0x120005b0c : c3e00000 30 br zero, 0x120005b10 0x120005b10 : 275e0001 9 ldah ra, 65536(sp) 0x120005b14 : a75a09f0 29 ldq ra, 2544(ra) 0x120005b18 : 253e0001 9 ldah s0, 65536(sp) 0x120005b1c : a52909f8 29 ldq s0, 2552(s0) 0x120005b20 : 279e0001 9 ldah at, 65536(sp) 0x120005b24 : 23dc0a50 8 lda sp, 2640(at) 0x120005b28 : 6bfa8001 1a ret zero, (ra), 1 Source routine: void output_line(struct _line *curline, enum section section, struct _function *fdata) { int i; int argnum; struct _word *curwordp; static int bold = FALSE; static int italic = FALSE; curwordp = curline->wordlist; if(curwordp == NULL) return; /* check for the modal start of line characters */ /* verbatim mode */ if(curwordp->word[0] == VERBATIM) { if(!verbatim) fprintf(docfile,"\\begin{verbatim}\n"); else fprintf(docfile,"\\end{verbatim}\n"); verbatim = !verbatim; return; } /* and listing mode ( only if we are not in verbatim ) */ if(!verbatim && curwordp->word[0] == '@') { if(!listing) { listing = TRUE; fprintf(docfile,"\\begin{itemize}\n"); fprintf(docfile,"\\item{"); } else { fprintf(docfile,"}\n"); fprintf(docfile,"\\item{"); } /* strip the @ and any leading spaces */ for(curwordp = curwordp->nextwordp; curwordp != NULL && isspace(curwordp->word[0]); curwordp = curwordp->nextwordp) ; } /* if we are outputting return codes check for status code words */ if(section == returncodes && is_a_status_code(curwordp->word)) { fprintf(docfile,"\\Retcode{"); output_string(docfile,curwordp->word); fprintf(docfile,"}\n"); curwordp = curwordp->nextwordp; } for(;curwordp != NULL;curwordp = curwordp->nextwordp) { if(curwordp->word[0] == BOLDSTART) { if(!bold) { fprintf(docfile,"{\\bf "); bold = TRUE; } else fprintf(stderr,"Bold start sequence \'<<\' found in BOLD block at line %d\n",curline->lineno); } else if(bold && curwordp->word[0] == BOLDEND) { fprintf(docfile,"}"); bold = FALSE; } else if(curwordp->word[0] == ITALSTART) { if(!italic) { fprintf(docfile,"{\\em "); italic = TRUE; } else fprintf(stderr,"Italic start sequence \'[[\' found in ITALIC block\n at line %d",curline->lineno); } else if(italic && curwordp->word[0] == ITALEND) { fprintf(docfile,"}"); italic = FALSE; } else if (curwordp->word[0] == IGNOREPARAM) ignoreparam = !ignoreparam; else if (curwordp->word[0] == '!' && curwordp->nextwordp == NULL) { if(listing) { fprintf(docfile,"}\n\\end{itemize}\n"); listing = FALSE; } else fprintf(docfile,"\\\\"); } else if(section != introduction && !bold && isalpha(curwordp->word[0]) && is_an_arg(curwordp->word,*fdata,&argnum) && !verbatim && !ignoreparam) { fprintf(docfile,"{\\bf "); output_string(docfile,curwordp->word); fprintf(docfile,"}"); } else output_string(docfile,curwordp->word); } fprintf(docfile,"\n"); }