http://llvm.org/bugs/show_bug.cgi?id=14966

             Bug #: 14966
           Summary: A debug info issue when passing a struct by value
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected],
                    [email protected]
    Classification: Unclassified


There's an issue with debug information when passing a particular struct by
value.

$ head -n 100 z.cc zz.cc
==> z.cc <==
enum A {A_1};
typedef struct { enum A a; int b; const void *c[3]; } S;

const void *f2(S s);

__attribute__((noinline)) const void *f1(S s) {
  return f2(s);
}

int main() {
  S s = { A_1, 1, {(const void*)10, (const void*)20, (const void*)30} };
  f1(s);
}

==> zz.cc <==
enum A {A_1};
typedef struct { enum A a; int b; const void *c[3]; } S;

const void *f2(S s) {
  return s.c[2];
}

$ gdb ./a.out
GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /tmp/yyy/a.out...done.
(gdb) b main
Breakpoint 1 at 0x4005f4: file z.cc, line 11.
(gdb) r
Starting program: /tmp/yyy/a.out

Breakpoint 1, main () at z.cc:11
11        S s = { A_1, 1, {(const void*)10, (const void*)20, (const void*)30}
};
(gdb) n
12        f1(s);
(gdb) s
f1 (s=...) at z.cc:7
7         return f2(s);
(gdb) p s
$1 = {a = 4294959648, b = 32767, c = {0x7ffff7639320, 0x7ffff7deb310, 0x0}}  //
<--- what?
(gdb) s
f2 (s=...) at zz.cc:4
4       const void *f2(S s) {
(gdb) n
5         return s.c[2];
(gdb) p s
$2 = {a = A_1, b = 1, c = {0xa, 0x14, 0x1e}}

-- 
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to