Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Oct 1995 02:42:47 -0400 (EDT)
From:      Andrew White <awhite@dca.net>
To:        freebsd-bugs@freebsd.org
Subject:   bug with gcc 2.6.2?
Message-ID:  <Pine.BSF.3.91.951005022938.4818Q-100000@dca.net>

next in thread | raw e-mail | index | archive | help
FreeBSD bugs list:

The following code generates a segmentation violation using gcc 2.6.2 as 
shipped with FreeBSD 2.0-RELEASE.  It shouldn't!  It seems as if any of 
the string functions (strcmp, strcpy, etc) bomb when invoked with a null 
string.

I compiled this using gcc 2.3.3 under AIX 3.2.5, and it works as expected 
(prints "x is -1" when run).  I am compiling this program (I called it 
test.c) with: "gcc -o test test.c"... am I missing something obvious??

Perplexed,
  Andrew

------test.c-------
#include <stdio.h>
#include <strings.h>
 
int main()
{
   char *s;
   int x;
 
   s=NULL;
 
   x=strcmp(s,"test");
   printf("x is %d\n",x);
   return 0;
}
------test.c--------


awhite@dca.net    http://www.dca.net/       (work-related)
Andrew@White.org  http://andrew.white.org/  (personal)
DCANET: The Delaware Common Access Network 
Call (302) 654-1019 or send mail to info@dca.net for more information.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.91.951005022938.4818Q-100000>