From owner-freebsd-stable Wed Oct 9 8:30:34 2002 Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A12F437B401 for ; Wed, 9 Oct 2002 08:30:31 -0700 (PDT) Received: from bcrail.com (ftp.bcrail.com [198.57.70.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id 38AAE43E42 for ; Wed, 9 Oct 2002 08:30:31 -0700 (PDT) (envelope-from ChildsC@bcrail.com) Received: by gatekeeper.bcrail.com id <119096>; Wed, 9 Oct 2002 08:22:21 -0700 Content-return: allowed Date: Wed, 09 Oct 2002 08:30:20 -0700 From: ChildsC@bcrail.com Subject: RE: gcc2.95.4 pointer not defined To: josepht@cstone.net, freebsd-stable@FreeBSD.ORG Message-Id: <02Oct9.082221pdt.119096@gatekeeper.bcrail.com> MIME-version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-type: text/plain Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG The error is valid because you need to allocate some space for the integer that your pointer points to such as: /* pointer.c - pointer test */ #include #include int main (void) { int *ip; ip = malloc( sizeof(int) ); *ip = 50; printf ("%d\n", *ip); return (EXIT_SUCCESS); } -----Original Message----- From: Joe Talbott [mailto:josepht@cstone.net] Sent: Wednesday, October 09, 2002 8:18 AM To: freebsd-stable@freebsd.org Subject: gcc2.95.4 pointer not defined With the following simple program on 4.6-STABLE from Mon Sep 9 11:27:32 EDT 2002 roughly (tried as well on 4.6-STABLE from Mon Jun 24 18:24:30 EDT 2002) both gcc 2.95.4 20020320. Both give SIGSEGV on line 9 (*ip = 50). gdb tells me: ip = (int *) 0x0 Here's the source: /* pointer.c - pointer test */ #include #include int main (void) { int *ip; *ip = 50; printf ("%d\n", *ip); return (EXIT_SUCCESS); } I've tried this on a RedHat box and a SunOS box both worked as expected. Joe -- Memory is the second thing to go as you get older. I forget what the first one was... -- I forgot To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message