News for hackers. Stuff that matters.
Re:What Every C Programmer Should Know About Undefined Behav... by Peaker on Thursday May 12, 2011 @09:31AM (#2540498)
I had a similar bug. Using a tracing framework of macros, I had something like:

    #define TRACE_FOO(foo_ptr)  TRACE_INT((foo_ptr)->x)

    ...

    TRACE_ENTER(TRACE_INT(x) TRACE_FOO(foo_ptr));
    if(!foo_ptr) return NULL;

    use foo-ptr
The NULL check was optimized out. The dereference of foo_ptr was hidden behind TRACE_FOO, which made it even harder to spot. I spent hours on that one :-)

There are no comments on this comment yet.