[llvm-bugs] [Bug 47556] New: Constructor homing missing anonymous union

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Sep 16 18:18:31 PDT 2020


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

            Bug ID: 47556
           Summary: Constructor homing missing anonymous union
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: DebugInfo
          Assignee: unassignedbugs at nondot.org
          Reporter: akhuang at google.com
                CC: jdevlieghere at apple.com, keith.walker at arm.com,
                    llvm-bugs at lists.llvm.org,
                    paul_robinson at playstation.sony.com

This was reported internally but I'll upload it here too. Basically with
-debug-info-kind=constructor the type info for the anonymous union is
incomplete.

$ cat t.cc
void *operator new(unsigned long, void *p) { return p; }

struct TestStruct {
  int val;
};

struct OptionalStorageBase {
  constexpr OptionalStorageBase() : empty_('\0') {}

  union {
    char empty_;
    TestStruct value_;
  };
};

int main() {
  OptionalStorageBase t_opt;
  new (&t_opt.value_) TestStruct(TestStruct{20});
  return t_opt.value_.val;
}
$ clang -cc1 -debug-info-kind=constructor -emit-llvm t.cc -o - | grep
"DW_TAG_union_type,"
$ !30 = !DICompositeType(tag: DW_TAG_union_type, scope: !27, file: !5, line:
10, size: 32, flags: DIFlagFwdDecl, identifier:
"_ZTSN19OptionalStorageBaseUt_E")
$
$ clang -cc1 -debug-info-kind=limited -emit-llvm t.cc -o - | grep
"DW_TAG_union_type"
$ !30 = distinct !DICompositeType(tag: DW_TAG_union_type, scope: !27, file: !5,
line: 10, size: 32, flags: DIFlagExportSymbols | DIFlagTypePassByValue,
elements: !31, identifier: "_ZTSN19OptionalStorageBaseUt_E")

-- 
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/20200917/370f0f3f/attachment.html>


More information about the llvm-bugs mailing list