Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* Re: Another C compiler problem
  1996-05-20  4:00 Another C compiler problem Bill James
@ 1996-05-20  4:00 ` Pete Bradley
  1996-05-21  4:00   ` Bill James
  0 siblings, 1 reply; 3+ messages in thread
From: Pete Bradley @ 1996-05-20  4:00 UTC (permalink / raw)



Bill James wrote:
> 
> 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:
> 
[generated code deleted]
> 
> Source routine:
> 
[source of offending routine deleted]

    I almost hate to ask this, but are you sure the code is ok? (lint clean,
doesn't assume anything about data sizes; doesn't invoke undefined
behavior, etc)?

                                           Pete

-- 
  Pete Bradley        | The contents of this message express only the sender's
  United Technologies | opinion and do not necessarily reflect the policy or 
  Pratt & Whitney     | views of United Technologies. All responsibility for 
                      | the statements made in this Usenet posting resides 
                      | solely and completely with the sender.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Another C compiler problem
@ 1996-05-20  4:00 Bill James
  1996-05-20  4:00 ` Pete Bradley
  0 siblings, 1 reply; 3+ messages in thread
From: Bill James @ 1996-05-20  4:00 UTC (permalink / raw)
  Cc: bill


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 <output_line+2144>: 263dffff  9     ldah    a1, -65536(gp)
0x120005d34 <output_line+2148>: 22317b10  8     lda     a1, 31504(a1)
0x120005d38 <output_line+2152>: a77d8388 29     ldq     t12, -31864(gp)
0x120005d3c <output_line+2156>: 6b5b7d9c 1a     jsr     ra, (t12),
0x1200053b0
0x120005d40 <output_line+2160>: 27ba2000  9     ldah    gp,
536870912(ra)
0x120005d44 <output_line+2164>: 23bd4e90  8     lda     gp, 20112(gp)
** Common return code **
0x120005d48 <output_line+2168>:
    c3e00000 30 br      zero, 0x120005d4c <output_line+2172>
** Silly instruction **
0x120005d4c <output_line+2172>: a73be5b0 29     ldq     t11, -6736(t12)
**
0x120005d50 <output_line+2176>: 275e0001  9     ldah    ra, 65536(sp)
0x120005d54 <output_line+2180>: a75a09f0 29     ldq     ra, 2544(ra)
0x120005d58 <output_line+2184>: 253e0001  9     ldah    s0, 65536(sp)
0x120005d5c <output_line+2188>: a52909f8 29     ldq     s0, 2552(s0)
0x120005d60 <output_line+2192>: 279e0001  9     ldah    at, 65536(sp)
0x120005d64 <output_line+2196>: 23dc0a50  8     lda     sp, 2640(at)
0x120005d68 <output_line+2200>: 6bfa8001 1a     ret     zero, (ra), 1


Good code from OSFCMPLRS200:

0x120005af0 <output_line+2128>: a6100000 29     ldq     a0, 0(a0)
0x120005af4 <output_line+2132>: a63d8028 29     ldq     a1, -32728(gp)
0x120005af8 <output_line+2136>: 223183d0  8     lda     a1, -31792(a1)
0x120005afc <output_line+2140>: a77d8440 29     ldq     t12, -31680(gp)
0x120005b00 <output_line+2144>: 6b5b6077 1a     jsr     ra, (t12),
0x11fffdce0
0x120005b04 <output_line+2148>: 27ba2000  9     ldah    gp,
536870912(ra)
0x120005b08 <output_line+2152>: 23bd50cc  8     lda     gp, 20684(gp)
0x120005b0c <output_line+2156>:
    c3e00000 30 br      zero, 0x120005b10 <output_line+2160>
0x120005b10 <output_line+2160>: 275e0001  9     ldah    ra, 65536(sp)
0x120005b14 <output_line+2164>: a75a09f0 29     ldq     ra, 2544(ra)
0x120005b18 <output_line+2168>: 253e0001  9     ldah    s0, 65536(sp)
0x120005b1c <output_line+2172>: a52909f8 29     ldq     s0, 2552(s0)
0x120005b20 <output_line+2176>: 279e0001  9     ldah    at, 65536(sp)
0x120005b24 <output_line+2180>: 23dc0a50  8     lda     sp, 2640(at)
0x120005b28 <output_line+2184>: 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");
}



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Another C compiler problem
  1996-05-20  4:00 ` Pete Bradley
@ 1996-05-21  4:00   ` Bill James
  0 siblings, 0 replies; 3+ messages in thread
From: Bill James @ 1996-05-21  4:00 UTC (permalink / raw)



Pete Bradley wrote:
> 
> Bill James wrote:
> >
> > 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:
> >
> [generated code deleted]
> >
> > Source routine:
> >
> [source of offending routine deleted]
> 
>     I almost hate to ask this, but are you sure the code is ok? (lint clean,
> doesn't assume anything about data sizes; doesn't invoke undefined
> behavior, etc)?
> 

	It should be OK - it also compiles/runs on every other platform we have
- Solaris 1 and 2, HP-UX, AIX, Ultrix. Do you think this can be the
cause of such an effect?

Bill



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1996-05-21  4:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-05-20  4:00 Another C compiler problem Bill James
1996-05-20  4:00 ` Pete Bradley
1996-05-21  4:00   ` Bill James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox