Path: utzoo!attcan!uunet!cs.utexas.edu!sun-barr!decwrl!ucbvax!BRL.MIL!moss From: moss@BRL.MIL ("Gary S. Moss", VLD/VMB) Newsgroups: comp.sys.sgi Subject: Bug on IRIX 4d 3.1 when -02 level optimizer used. Message-ID: <8905261348.aa19797@VMB.BRL.MIL> Date: 26 May 89 17:48:38 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 51 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 #include 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 ); }