[llvm-bugs] [Bug 38608] New: Fragment variable size verification fails during LTO in presence of ODR violations

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 16 16:21:22 PDT 2018


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

            Bug ID: 38608
           Summary: Fragment variable size verification fails during LTO
                    in presence of ODR violations
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: DebugInfo
          Assignee: unassignedbugs at nondot.org
          Reporter: rnk at google.com
                CC: bjorn.a.pettersson at ericsson.com,
                    llvm-bugs at lists.llvm.org, llvm at inglorion.net,
                    peter at pcc.me.uk

Our Chromium ThinLTO bot has been red longer than we have history for it, and I
think it was caused by r334830 from June.

During LTO, our bot is now producing this error:
fragment is larger than or outside of variable
  call void @llvm.dbg.value(metadata i8 %9, metadata !2265359, metadata
!DIExpression(DW_OP_LLVM_fragment, 96, 8)), !dbg !2265363
!2265359 = !DILocalVariable(name: "p", scope: !2265356, f

Here is a reduction of the problem:

// a.cpp
struct ViolateODR {
  int x;
};
int use_small_struct(ViolateODR o) {
  return o.x;
}
int do_sroa(int x, int y);
int main() {
  ViolateODR o = {0};
  return use_small_struct(o) + do_sroa(1, 2);
}

// b.cpp
struct ViolateODR {
  int x;
};
int use_small_struct(ViolateODR o) {
  return o.x;
}
int do_sroa(int x, int y);
int main() {
  ViolateODR o = {0};
  return use_small_struct(o) + do_sroa(1, 2);
}

// script
$ clang-cl -Z7 -flto=thin -c a.cpp b.cpp -O2 && lld-link a.obj b.obj -out:t.exe
fragment covers entire variable
  call void @llvm.dbg.value(metadata i32 %3, metadata !17, metadata
!DIExpression(DW_OP_LLVM_fragment, 0, 32)), !dbg !24
!17 = !DILocalVariable(name: "o", scope: !10, file: !1, line: 6, type: !18)

OK, so maybe I got a.cpp and b.cpp swapped, but you see the point. I don't
think verifier errors during LTO are a reasonable failure mode for ODR
violations.

I would prefer it if instead dbg.value problems could be reported as warnings
and we could locally discard the problematic dbg.value instructions.

-- 
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/20180816/a42678c0/attachment.html>


More information about the llvm-bugs mailing list