Bug on IRIX 4d 3.1 when -02 level optimizer used.

"Gary S. Moss", VLD/VMB moss at BRL.MIL
Sat May 27 03:48:38 AEST 1989


Hi,
	Would someone look into this and at least see if it is present
on later releases of the IRIX for the 4D?

	I have finally boiled this one down to a nice little test case,
thanks to Doug Gwyn for his assistance in examining the assembly code.
We spent many hours trying to find something wrong with the generated
code, and although we saw some wasteful steps that were puzzling, no
errors were found.  This seems to point to a microcode or hardware-related
problem.  The code fails the same way on the 2 4Ds that I have tried it
on, one a 4D/60T, and the other with the GT option.  If compiled with
default optimization, it will successfully parse the string "1 2 3" into
3 args, but when compiled with -O2, it only gets the first 2 arguments.
For some reason 'strtok' is found to return NULL when it should have
returned "3".

	If sending to this list is not sufficient, would someone at SGI
please let me know?

Thanks much,
-moss

---------------------------------- cut me ---------------------------------
#include <stdio.h>
#include <string.h>

static void
user_Input( args )
char	*args[];
	{	register int	i;
	if( (args[0] = strtok( "1 2 3", " \t" )) == NULL )
		return;
	for( i = 1; args[i-1] != NULL ; ++i )
		args[i] = strtok( (char *) NULL, " \t" );

	write(2,"args:\n",6);
	for(i = 0;i<3;++i)
		{
		if(args[i])
			write(2,args[i],strlen(args[i]));
		else
			write(2,"(NULL)",6);
		write(2,"\n",1);
		}
	return;
	}

main()
	{	char *args[5];
	user_Input( args );
	}



More information about the Comp.sys.sgi mailing list