This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [DWARF] Tracking uninitialized variables

On 17/07/15 11:43, Nikolai Bozhenov wrote:

It is certainly true that debugging an optimized code is an inherently
difficult task. Though, I wonder if the compiler could make such
debugging experience slightly less surprising.

Consider the following example:

      1 extern void bar(int *i1, int *i2, int *i3);
      3 int __attribute__((noinline)) foo(int i1, int i2) {
      4   int a, b, c;
      5   a = i1 << i2;
      6   b = (i1 + i2) * i1;
      7   c = (b + i1);
      8   bar(&a, &b, &c);
      9 }
     11 int main() {
     12   foo(42, 12);
     13 }

Let's compile it:

     $ gcc-trunk tst.c -g -fvar-tracking-uninit -O2

Just a drive-by thought.
Have you tried the -Og option? The documentation for it says:
"Optimize debugging experience.-Ogenables optimizations that do not interfere with debugging. It should be the optimization level of choice for the standard edit-compile-debug cycle, offering a reasonable level of optimization while maintaining fast compilation and a good debugging experience."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]