[LLVMbugs] [Bug 14580] New: Debug info does not have a line entry at the end of the function

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Dec 11 16:14:01 PST 2012


             Bug #: 14580
           Summary: Debug info does not have a line entry at the end of
                    the function
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: googler
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: dblaikie at gmail.com
                CC: dgregor at apple.com, echristo at gmail.com,
                    llvmbugs at cs.uiuc.edu
            Blocks: 14330
    Classification: Unclassified

This is probably not a bug but it is a difference in behavior compared to GCC &
I wanted somewhere to record the test cases/variations that depend on this
behavior so we can make an informed decision about whether GCC compatibility is
valuable here.

The essence of this variance is that with GCC's debug info for this function:

int func(int a, int b) {
  return a + b;

there are two separate lines in this function that you can break on/'next' to:
the "return" line, and the closing brace. All the side effects of evaluating
the return expression are evaluated when evaluating the return line and can be
observed while still in the context of the function if you break on the "}"

Clang produces two lines for this function too, but they are the start of the
function (on the "int func(int a, int b) {" line) which includes the preamble &
the like, I assume, and the return line. If you step over the return line, you
step out of the function immediately & cannot directly observe the side effects
of the callee from within it, only from outside it (if you have identifiers
that contain the value of those side effects).

(interestingly, if you just have "int main() { return func(3, -3); } and you
break on func, use "next" to step to the "return" line, then use "next" again -
on that second "next", because there's no line for the end of func nor the end
of main, you end up in libc:
__libc_start_main (main=<optimized out>, argc=<optimized out>,
ubp_av=<optimized out>, init=<optimized out>, fini=<optimized out>, 
    rtld_fini=<optimized out>, stack_end=0x7fffffffdb78) at libc-start.c:258
258     libc-start.c: No such file or directory.

This has come up in gdb.mi/mi-var-cp.exp which attempted to step over a single
return statement then expected to be still within the context of the callee and
interact with some variables.

Again - I'm making no claim that this is a bug, merely recording the relevant
data so we can make an informed decision about the desired behavior here.

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list