DragonFly users List (threaded) for 2008-07
DragonFly BSD
DragonFly users List (threaded) for 2008-07
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: Hammer on snapshot cd's


From: Vincent Stemen <vince.dragonfly@xxxxxxxxxxx>
Date: Tue, 15 Jul 2008 17:35:09 -0500

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@backplane.com>
> 

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





[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]