On Mon, Dec 14, 2009 at 01:53:30PM -0800, John Regehr wrote:
> > Optimizations based on uninitialized variables make me very nervous.
> > If uninitialized memory reads are transformed into don't-cares, then
> > checking tools like valgrind will no longer see the UMR (assuming that
> > the lack of initialization is a bug).
> >
> > Did I understand that icc does this?  It seems like a dangerous practice.
> 
> Yes, it looks like icc does this.  But so does gcc, see below.  There is 
> no "add" in the generated code.
> 
> John Regehr
> 
> 
> [reg...@babel ~]$ cat undef.c
> int foo (int x)
> {
>    int y;
>    return x+y;
> }

I'm less concerned about cases like this, because the compiler will
issue a warning for the uninitialized variable (if -Wall is included).

I would only be worried for cases where no warning is issued *and*
unitialized accesses are eliminated.

Reply via email to