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: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 15 Jul 2008 14:40:42 -0700 (PDT)

   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>



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