12.6. Disappointments and Misunderstandings

12.6 Disappointments and Misunderstandings

These problems are perhaps regrettable, but we don't know any practical way around them.

  • Certain local variables aren't recognized by debuggers when you compile with optimization.

    This occurs because sometimes GCC optimizes the variable out of existence. There is no way to tell the debugger how to compute the value such a variable “would have had”, and it is not clear that would be desirable anyway. So GCC simply does not mention the eliminated variable when it writes debugging information.

    You have to expect a certain amount of disagreement between the executable and your source code, when you use optimization.

  • Users often think it is a bug when GCC reports an error for code like this:
    int foo (struct mumble *);
    
    struct mumble { ... };
    
    int foo (struct mumble *x)
    { ... }

    This code really is erroneous, because the scope