r289996 - IRGen: Fix assertion failure when creating debug info for an integer constant wider than 64 bits.
Peter Collingbourne via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 16 14:10:52 PST 2016
Author: pcc
Date: Fri Dec 16 16:10:52 2016
New Revision: 289996
URL: http://llvm.org/viewvc/llvm-project?rev=289996&view=rev
Log:
IRGen: Fix assertion failure when creating debug info for an integer constant wider than 64 bits.
Added:
cfe/trunk/test/CodeGen/dbg-const-int128.c
Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=289996&r1=289995&r2=289996&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri Dec 16 16:10:52 2016
@@ -3759,12 +3759,15 @@ void CGDebugInfo::EmitGlobalVariable(con
if (GV)
return;
llvm::DIExpression *InitExpr = nullptr;
- if (Init.isInt())
- InitExpr =
- DBuilder.createConstantValueExpression(Init.getInt().getExtValue());
- else if (Init.isFloat() && CGM.getContext().getTypeSize(VD->getType()) <= 64)
- InitExpr = DBuilder.createConstantValueExpression(
- Init.getFloat().bitcastToAPInt().getZExtValue());
+ if (CGM.getContext().getTypeSize(VD->getType()) <= 64) {
+ // FIXME: Add a representation for integer constants wider than 64 bits.
+ if (Init.isInt())
+ InitExpr =
+ DBuilder.createConstantValueExpression(Init.getInt().getExtValue());
+ else if (Init.isFloat())
+ InitExpr = DBuilder.createConstantValueExpression(
+ Init.getFloat().bitcastToAPInt().getZExtValue());
+ }
GV.reset(DBuilder.createGlobalVariable(
DContext, Name, StringRef(), Unit, getLineNumber(VD->getLocation()), Ty,
true, InitExpr, getOrCreateStaticDataMemberDeclarationOrNull(VarD),
Added: cfe/trunk/test/CodeGen/dbg-const-int128.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/dbg-const-int128.c?rev=289996&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/dbg-const-int128.c (added)
+++ cfe/trunk/test/CodeGen/dbg-const-int128.c Fri Dec 16 16:10:52 2016
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -S -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s
+// CHECK: !DIGlobalVariable({{.*}}
+// CHECK-NOT: expr:
+
+static const __uint128_t ro = 18446744073709551615;
+
+void bar(__uint128_t);
+void foo() { bar(ro); }
More information about the cfe-commits
mailing list