Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Oct 2002 17:41:25 +0200
From:      Cliff Sarginson <cls@raggedclown.net>
To:        freebsd-stable@freebsd.org
Subject:   Re: gcc2.95.4 pointer not defined
Message-ID:  <20021009154125.GB797@raggedclown.net>
In-Reply-To: <20021009151803.GA14701@copper.eng.cstone.net>
References:  <20021009151803.GA14701@copper.eng.cstone.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Oct 09, 2002 at 11:18:03AM -0400, Joe Talbott wrote:
> 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 <stdio.h>
> #include <stdlib.h>
> 
> 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

Mmm..well they may have worked "as expected" but a SIGSEGV is what I
would expect. Where exactly is "ip" pointing to ? Maybe it needs some
space to point to !
And the Sunos C compiler is not a good reference point for acceptable
"C" ! You would be amazed at the things it lets by that are wrong.
-- 
Regards
   Cliff Sarginson 
   The Netherlands

       Email: cls@raggedclown.net
       Tel  : +31 (0)10 4764595

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021009154125.GB797>