[comp.bugs.sys5] pcc bug

guy%gorodish@Sun.COM (Guy Harris) (06/28/87)

> Bug:  pcc compiles without complaint the program:
> 
> main(x,y)
>     int x, main;
>     {
>     printf("oops\n");
>     }

Another one of many PCC front end problems.  A fix, of sorts - it
causes the compiler at least to recognize that "main" is not given in
the argument list.

*** pftn.c	Mon May  4 13:52:14 1987
--- pftn.c.fixed	Sat Jun 27 00:19:38 1987
***************
*** 93,116 ****
  
  	if( stp == FTN && p->sclass == SNULL )goto enter;
  		/* name encountered as function, not yet defined */
- 	if( stp == UNDEF|| stp == FARG ){
- 		if( blevel==1 && stp!=FARG ) switch( class ){
  
! 		default:
! 			/* "declared argument %.8s is missing" */
! 			/* "declared argument %s is missing" */
! 			if(!(class&FIELD)) UERROR( MESSAGE( 28 ), p->sname );
! 		case MOS:
! 		case STNAME:
! 		case MOU:
! 		case UNAME:
! 		case MOE:
! 		case ENAME:
! 		case TYPEDEF:
! 			;
! 			}
! 		goto enter;
! 	}
  
  	if( type != stp ) goto mismatch;
  	/* test (and possibly adjust) dimensions */
--- 93,116 ----
  
  	if( stp == FTN && p->sclass == SNULL )goto enter;
  		/* name encountered as function, not yet defined */
  
! 	if( blevel==1 && stp!=FARG ) switch( class ){
! 
! 	default:
! 		/* "declared argument %.8s is missing" */
! 		/* "declared argument %s is missing" */
! 		if(!(class&FIELD)) UERROR( MESSAGE( 28 ), p->sname );
! 	case MOS:
! 	case STNAME:
! 	case MOU:
! 	case UNAME:
! 	case MOE:
! 	case ENAME:
! 	case TYPEDEF:
! 		;
! 		}
! 
! 	if( stp == UNDEF|| stp == FARG ) goto enter;
  
  	if( type != stp ) goto mismatch;
  	/* test (and possibly adjust) dimensions */
	Guy Harris
	{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
	guy@sun.com