Date: Fri, 02 Apr 2004 14:17:21 +0000 From: Jens Rehsack <rehsack@liwing.de> To: Rene Ladan <r.c.ladan@student.tue.nl> Cc: freebsd-current@freebsd.org Subject: Re: system's gcc bug? Message-ID: <406D75F1.8080103@liwing.de> In-Reply-To: <20040331101834.GA21652@dyn-099164.nbw.tue.nl> References: <20040331101834.GA21652@dyn-099164.nbw.tue.nl>
next in thread | previous in thread | raw e-mail | index | archive | help
Rene Ladan wrote:
> Hi,
>
> I'm getting runtime errors when executing the following program and
> declaring one of the arrays:
>
> ----------------
>
> #include <stdio.h>
>
> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?406D75F1.8080103>
