PCC, lint bug

BostonU SysMgr root%bostonu.csnet at csnet-relay.arpa
Tue Aug 27 23:47:25 AEST 1985


The following totally reasonable looking garbage compiles and passes
lint -hp without a peep. It printed garbage on my 4.2 VAX, core dumped
on my UNIX/PC (SYSV). I realize the difference between a two dimensional
array and a pointer to a pointer (or whatever, pluralize), apparently
neither C nor lint does. Sorry if this has been covered.

----------
main()
{
	int x[2][2] ;
	int **xp = x ;
	int i,j ;

	for(i=0 ; i < 2 ; i++)
		for(j=0 ; j<2 ; j++)
			printf("%d\n",x[i][j] = i+j) ;
	for(i=0 ; i < 2 ; i++)
		for(j=0 ; j < 2 ; j++)

			printf("%d\n",xp[i][j]) ;
}

----------
		-Barry Shein, Boston University
P.S. Found this while trying to speed up a hand translation of Footran->C



More information about the Comp.unix.wizards mailing list