[llvm-bugs] [Bug 39716] New: [DebugInfo] Unused arguments aren't visible in optimized code.

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Nov 19 16:36:35 PST 2018


https://bugs.llvm.org/show_bug.cgi?id=39716

            Bug ID: 39716
           Summary: [DebugInfo] Unused arguments aren't visible in
                    optimized code.
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: DebugInfo
          Assignee: unassignedbugs at nondot.org
          Reporter: davide at freebsd.org
                CC: aprantl at apple.com, friss at apple.com,
                    jdevlieghere at apple.com, keith.walker at arm.com,
                    llvm-bugs at lists.llvm.org, rnk at google.com,
                    vk at vedantk.com, vsk at apple.com, zturner at google.com

* thread #1, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x0000000100000f84 a.out`fn2(a=<unavailable>, b=<unavailable>,
c=<unavailable>) at optout.c:12:10 [opt]
   9    fn2 (long int a, long int b, long int c)
   10   {
   11     long int q = 2 * a;
-> 12     return fn1 (5, 6, 7);
   13   }
   14   
   15   int main(void) {
(lldb) frame var 
(long) a = <no location, value may have been optimized out>

(long) b = <no location, value may have been optimized out>

(long) c = <no location, value may have been optimized out>

(long) q = <no location, value may have been optimized out>


A gcc-built binary debugged with gdb yields:

Breakpoint 1, main () at opt.c:16
16                      return fn2(14, 23, 34);
(gdb) s
fn2 (c=34, b=23, a=14) at opt.c:12
12                  return fn1 (5, 6, 7);
(gdb) info args
c = 34
b = 23
a = 14


Testcase:

__attribute__((noinline))
int fn1 (long int x, long int y, long int z) {
        int l = x * 2;
        int q = y * z;
        return l + q;
}

__attribute__((noinline)) long int
fn2 (long int a, long int b, long int c)
{
  long int q = 2 * a;
  return fn1 (5, 6, 7);
}

int main(void) {
        return fn2(14, 23, 34);
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181120/f90d5b89/attachment.html>


More information about the llvm-bugs mailing list