https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65797

            Bug ID: 65797
           Summary: [5.0 regression] IPA ICF causes function to be emitted
                    with no debug line info
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: hubicka at ucw dot cz
          Reporter: ian at airs dot com

This stand alone test case is boiled down from libgo/runtime/go-make-slice.c.


typedef unsigned int uintptr_t __attribute__ ((mode (pointer)));
typedef unsigned int uint64_t __attribute__ ((mode (DI)));

extern int f1 (char *, uintptr_t, uintptr_t);

int
f2 (char *p, uintptr_t s)
{
  return f1 (p, s, s);
}

int
f4 (char *p, uint64_t s1, uint64_t s2)
{
  uintptr_t t1, t2;

  t1 = (uintptr_t) s1;
  if ((uint64_t) t1 != s1)
    return 0;

  t2 = (uintptr_t) s2;
  if ((uint64_t) t2 != s2)
    return 0;

  return f1 (p, t1, t2);
}

int
f3 (char *p, uint64_t s)
{
  return f4 (p, s, s);
}


When I compile this -g -O2 -fno-optimize-sibling-calls on x86_64 f2 is
converted into a function that does nothing but call f3.  From the standpoint
of execution that is fine.  What is not fine is that f2 is emitted with no
debug line information.  When compiling for x86_64, the .s output is:

        .p2align 4,,15
        .globl  f2
        .type   f2, @function
f2:
.LFB4:
        .cfi_startproc
        subq    $8, %rsp
        .cfi_def_cfa_offset 16
        call    f3
        addq    $8, %rsp
        .cfi_def_cfa_offset 8
        ret
        .cfi_endproc
.LFE4:
        .size   f2, .-f2

Note the absence of any .loc directives.

This is causing a failure in the libgo testsuite (runtime/pprof on x86_64). 
The failure is, essentially, a failure of the stack backtrace to determine the
name of the function f2.  In the absence of line information the library is
unable to know the name of the function.

Reply via email to