[gnu.gcc.bug] gcc 1.31 produces incorrect asm code with -p option on 386

schmidt%blanche.ics.uci.edu@ORION.CF.UCI.EDU ("Douglas C. Schmidt") (11/24/88)

Bug Report for GCC:
- -------------------
Problem : gcc 1.31 produces incorrect asm code with -p option on 
	  the sequent 386. 

1.) Version : gcc 1.31
- -----------

2.) Input Program :
- -----------------
/* compile with -p on the Sequent Symmetry */

#include <stdio.h>
#include "mylib.h"
#include "myincludes.h"

#define MIN_WORD_SIZE       2
#define MAX_WORD_SIZE       9
#define MIN_KEY_SIZE        4
#define MAX_KEY_SIZE        72

/*
perfect: 36 keywords
perfect: 69 is the maximum key range
*/

static unsigned char access_table[] = {
            0,  0,  0,  0,  0,  4,  4,  4,  4,  4,
            4,  8, 13, 17, 17, 25, 25, 29, 35, 39,
           44, 52, 56, 60, 66, 71, 74, 82, 87, 93,
          100,100,103,108,110,119,119,122,128,135,
          141,146,152,158,158,158,158,158,164,164,
          164,164,164,164,168,168,176,176,178,178,
          178,178,178,178,184,184,184,184,184,184,
          184,184,184,190 };

static char *word_table = 
"elsecaseconstautocontinuecharexternenumbreakregistergoto\
longreturnwhileasmvolatilefloattypeoftypedefforuniondo__alignof\
intdoubledefaultinlineshortstructswitchstaticvoidunsignedif\
sizeofsigned";

inline static int hash(str,len)
register char	*str;             
register int	len;
{
	static int   cval[] = {
		  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
		  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
		  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
		  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
		  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
		  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
		  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
		  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
		  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
		  0,  0,  0,  0,  0,  3,  0,  8, 14,  6,
		 31,  0, 22, 17,  1, 33,  0,  0,  1, 14,
		 11,  0,  0,  0,  6, 35,  0, 16, 18, 19,
		  0,  0,  0,  0,  0,  0,  0,  0, 
	};
	register int	hval;

	switch(hval = len) {
		default:
			hval += cval[(int)str[0]];
			hval += cval[(int)str[len - 1]];
		case 0:
			return(hval);
	}
}

inline static in_word_set(str,len)
register char *str;
register int len;
{
	if (len >= MIN_WORD_SIZE && len <= MAX_WORD_SIZE) {
		register int key = hash(str,len);

		if (key >= MIN_KEY_SIZE && key <= MAX_KEY_SIZE) {
			register int i = access_table[key];
			register int j = access_table[key+1];

			while (i < j) {
				if (*str++ != word_table[i++]) {
					return(0);
				}
			}

			return(*str == '\0');
		}
	}
	return(0);
}

main() {
   char Buf[80];
   int  Len;
   int  i = 0;

   while((Len = Get_Line(Buf,80)) != EOF) {
      if (in_word_set(Buf,Len)) {
         i++;
      }
   }
   printf("i = %d\n",i);
}


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

4.) Files used : config.gcc sequent-386
- --------------

5.) Machine(s) used :
- -------------------
		Sequent Symmetry    DYNIX (TM)V3 (BSD 4.3 features)

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

gcc version 1.31
 /usr/public/lib/gcc/gcc-cpp -v -I/q1/ue/schmidt/include/ -undef -D__GNU__ -D__GNUC__ -Dunix -Di386 -Dsequent prof-bug.1.28.c /tmp/cc005213.cpp
GNU CPP version 1.31
 /usr/public/lib/gcc/gcc-cc1 /tmp/cc005213.cpp -quiet -dumpbase prof-bug.1.28.c -version -p -o /tmp/cc005213.s
GNU C version 1.31 (80386, BSD syntax) compiled by GNU C version 1.31.
 as /tmp/cc005213.s -o prof-bug.1.28.o
Assembler:
"prof-bug.1.28.c", line 232: "lea" is not followed by a ':' for a label definition