[gnu.gcc.bug] gcc 1.28 produces faulty asm output for sparc.

schmidt%siam.ics.uci.edu@ORION.CF.UCI.EDU ("Douglas C. Schmidt") (09/20/88)

Bug Report for GCC:
-------------------
Problem :  gcc 1.28 -O produces assembly code on the sparc that is disagreeable
	        to the assembler.  I wish I could be more specific as to the
           line of source code responsible for this, but I don't read
           sparc asm (yet).  The assembly code, annotated at the site
           of the complaint, is enclosed below.

1.) Version : gcc 1.28
-----------

2.) Input Program :
-----------------
s22(pd0)                 /* 2.2 Identifiers (Names)      */
   struct defs {
     int cbits;          /* No. of bits per char           */
     int ibits;          /*                 int            */
     int sbits;          /*                 short          */
     int lbits;          /*                 long           */
     int ubits;          /*                 unsigned       */
     int fbits;          /*                 float          */
     int dbits;          /*                 double         */
     float fprec;        /* Smallest number that can be    */
     float dprec;        /* significantly added to 1.      */
     int flgs;           /* Print return codes, by section */
     int flgm;           /* Announce machine dependencies  */
     int flgd;           /* give explicit diagnostics      */
     int flgl;           /* Report local return codes.     */
     int rrc;            /* recent return code             */
     int crc;            /* Cumulative return code         */
     char rfs[8];        /* Return from section            */
   };
struct defs *pd0;
{
   int longname, a234, a;

   int _, _234, A, rc;

   static char s22er[] = "s22,er%d\n";
   static char qs22[8] = "s22    ";

   char *ps, *pt;
                         /* Initialize                      */

   rc = 0;
   ps = qs22;
   pt = pd0 -> rfs;
   while (*pt++ = *ps++);

     /* An identifier is a sequence of letters and digits;
        the first character must be a letter. The under-
        score _ counts as a letter.                        */

   a=1;
   _=2;
   _234=3;
   a234=4;
   if(a+_+_234+a234 != 10) {
     rc = rc+1;
     if(pd0->flgd != 0) printf(s22er,1);
   }

   /* Upper and lower case letters are different.     */

   A = 2;
   if (A == a) {
     rc = rc+4;
     if (pd0->flgd != 0) printf(s22er,4);
   }

   return(rc);
}

3.) Command Used : gcc -O
----------------

4.) Files used :
--------------
		tm.h          -> tm-sparc.h
		md            -> sparc.md
      config.h      -> config-sun4.h
      aux-output.c  -> output-sparc.c
      
5.) Machine(s) used :
-------------------
   Sun 4 running Sun4.0

6.) Compiler diagnostics :
------------------------

as: "s22.s", line 28: error: statement syntax

7.) Assembler output:

.data
_s22er.0:
	.ascii "s22,er%d\12\0"
_qs22.1:
	.ascii "s22    \0"
.text
	.align 4
.global _s22
	.proc 1
_s22:
	!#PROLOGUE# 0
	save %sp,-112,%sp
	!#PROLOGUE# 1
	mov %i0,%o3
	mov 0,%l0
	set _qs22.1,%o2
	add %o3,60,%o1
L2:
	ldsb [%o2],%o0
	stb %o0,[%o1]
	add %o2,1,%o2
	add %o1,1,%o1
	sll %o0,0x18,%o0
	sra %o0,0x18,%o0
	tst %o0
	bne L2
	nop
	cmp 1,2               /* here's the offending line */
	bne L6
	nop
	add %l0,4,%l0
	ld [%o3+44],%o0
	tst %o0
	be L6
	nop
	set _s22er.0,%o0
	call _printf
	mov 4,%o1
L6:
	mov %l0,%i0
	ret
	restore