r289996 - IRGen: Fix assertion failure when creating debug info for an integer constant wider than 64 bits.
Adrian Prantl via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 19 18:03:35 PST 2016
> On Dec 16, 2016, at 2:10 PM, Peter Collingbourne via cfe-commits <cfe-commits at lists.llvm.org> wrote:
>
> 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.
FYI, that representation is the somewhat unwieldy composition of:
DIGlobalVariableExpression(var: ![v], expr: !DIExpression(DW_OP_constu, [lo], DW_OP_stack_value, DW_OP_LLVM_fragment, 64, 0))
DIGlobalVariableExpression(var: ![v], expr: !DIExpression(DW_OP_constu, [hi], DW_OP_stack_value, DW_OP_LLVM_fragment, 64, 64))
-- adrian
> + 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); }
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list