From owner-freebsd-current@FreeBSD.ORG Fri Apr 2 06:17:28 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D6F0216A4CE for ; Fri, 2 Apr 2004 06:17:28 -0800 (PST) Received: from mail.liwing.de (mail.liwing.de [213.70.188.162]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0B3B043D5A for ; Fri, 2 Apr 2004 06:17:28 -0800 (PST) (envelope-from rehsack@liwing.de) Received: (qmail 30168 invoked from network); 2 Apr 2004 14:17:21 -0000 Received: from stingray.liwing.de (HELO liwing.de) ([213.70.188.164]) (envelope-sender ) by mail.liwing.de (qmail-ldap-1.03) with SMTP for ; 2 Apr 2004 14:17:21 -0000 Message-ID: <406D75F1.8080103@liwing.de> Date: Fri, 02 Apr 2004 14:17:21 +0000 From: Jens Rehsack User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.6) Gecko/20040323 X-Accept-Language: de-de, de, en-us, en MIME-Version: 1.0 To: Rene Ladan References: <20040331101834.GA21652@dyn-099164.nbw.tue.nl> In-Reply-To: <20040331101834.GA21652@dyn-099164.nbw.tue.nl> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: freebsd-current@freebsd.org Subject: Re: system's gcc bug? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Apr 2004 14:17:29 -0000 Rene Ladan wrote: > Hi, > > I'm getting runtime errors when executing the following program and > declaring one of the arrays: > > ---------------- > > #include > > int main(void) { > /* int a[4] = { 0, 1, 2, 3 }; enable this line to get a buserror */ > int *i; > /* int b[4] = { 0, 1, 2, 3 }; enable this line to get a segfault */ > for (*i = 0; *i < 4; (*i)++) > printf("%p %i\n", i, *i); > return(0); > } > > ---------------- > > I'm running system's gcc on 5.2.1-release: > > Using built-in specs. > Configured with: FreeBSD/i386 system compiler > Thread model: posix > gcc version 3.3.3 [FreeBSD] 20031106 > > I have not yet mailed to the gcc developers, as the system gcc is > somewhat patched. Neither have I filed a PR yet. $ gcc -o test2 -W -O test2.c test2.c: In function `main': test2.c:6: warning: `i' might be used uninitialized in this function Some warnings doesn't occur without using '-O', so the recommented compile may be 'gcc -W -Wall -O ...' Furthermore it's never wrong using lint(1): $ lint test2.c test2.c: test2.c(8): warning: i may be used before set [158] stdio.h(76): warning: struct __sFILEX never defined [233] lint: cannot find llib-lc.ln Lint pass2: printf used( test2.c(9) ), but not defined Best regards, Jens