http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54971



             Bug #: 54971

           Summary: SRA pessimizes debug info by not creating debug stmts

                    for fields without replacements

    Classification: Unclassified

           Product: gcc

           Version: 4.8.0

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: debug

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: ja...@gcc.gnu.org

                CC: jamb...@gcc.gnu.org





Consider the testcase in PR54970, or the following one.



int

main ()

{

  int a[] = { 1, 2, 3 };

  int *p = a + 2;

  int *q = a + 1;

  asm volatile ("nop");

  *p += 10;

  asm volatile ("nop");

  *q += 10;

  asm volatile ("nop");

  __builtin_memcpy (&a, (int [3]) { 4, 5, 6 }, sizeof (a));

  asm volatile ("nop");

  *p += 10;

  asm volatile ("nop");

  *q += 10;

  asm volatile ("nop");

  return 0;

}



For a[1] and a[2] replacements are created and we eventually get corret debug

info, tracking the value changes of those array elements.

But for a[0] SRA decides not to create a replacement, as it seems to be only

assigned and never read (in PR54970 testcase just once, in the above testcase

twice).

Would it be possible for MAY_HAVE_DEBUG_STMTS to create also replacements for

those fields/elements that are only ever assigned, and at the places they used

to be assigned instead of setting the replacement to the value it should have

create a debug bind stmt?  In the above testcase that would be at the place

of former a[0] = 1; add DEBUG a$0 => 1 stmt (where a$0's DECL_DEBUG_EXPR would

be a[0]), and at the point of the MEM[&a, 0] = MEM[something, 0] assignment

DEBUG a$0 => 4 ?

Reply via email to