Hammer on snapshot cd's

Vincent Stemen vince.dragonfly at hightek.org
Tue Jul 15 15:40:13 PDT 2008


On Tue, Jul 15, 2008 at 02:40:42PM -0700, Matthew Dillon wrote:
>    One interesting thing I've found on GCC-4 is that the callgraph analyzer
>    will cross procedure boundaries for all procedures in that particular
>    source file.  It can actually detect that error is left uninitialized
>    in this situation:
> 
>     cc -Wall x.c -c -O2
>     x.c: In function 'fubar2':
>     x.c:16: warning: 'error' is used uninitialized in this function
> 
>     (edit so *valuep is set to 0)
> 
>     cc -Wall x.c -c -O2
>     (no warning reported)
> 
> #include <stdio.h>
> 
> void
> fubar1(int *valuep)
> {
>     /* *valuep = 0; */
> }
> 
> void
> fubar2(void)
> {
>     int error;
> 
>     fubar1(&error);
>     printf("error = %d\n", error);
> }
> 
>     GCC-4 actually caught a bug during HAMMER development from that sort
>     of thing.  I was impressed.
> 
> 					-Matt
> 					Matthew Dillon 
> 					<dillon at backplane.com>
> 

Interesting.  Yep.  gcc 3.4.6 definitely does not warn on this.







More information about the Users mailing list