SystemZ regression (was: r223825 - DebugInfo: Emit the correct location for initialization of a complex variable)

Ulrich Weigand Ulrich.Weigand at
Tue Jan 13 10:57:26 PST 2015

David Blaikie wrote:

+void ComplexExprEmitter::EmitStoreOfComplex(ComplexPairTy Val, LValue
+                                            bool isInit,
+                                            SourceLocation DbgLoc) {
+  if (auto *DI = CGF.getDebugInfo())
+    DI->EmitLocation(CGF.Builder, DbgLoc);

This seems to have broken compiling functions that return complex values on
SystemZ.   This happens e.g. in the
SingleSource/UnitTests/conditional-gnu-ext test-suite case.  The symptom is
a failed assertion:

clang: /home/uweigand/llvm/llvm-head/tools/clang/lib/CodeGen/CGDebugInfo.cpp:2649:
 void clang::CodeGen::CGDebugInfo::EmitLocation
(clang::CodeGen::CGBuilderTy&, clang::SourceLocation, bool): Assertion
`!LexicalBlockStack.empty()' failed.
0  clang     0x000000008299efb0 llvm::sys::PrintStackTrace(_IO_FILE*) + 32
1  clang     0x000000008299d100
2  clang     0x000003ffffd82a2c
3 0x0000004d7295dcfe gsignal + 70
4 0x0000004d7295f652 abort + 326
5 0x0000004d729553aa
6 0x0000004d7295544c __assert_perror_fail + 0
7  clang     0x00000000805aa4fa
8  clang     0x00000000807088a0
9  clang     0x0000000080708bf8
llvm::Value*>, clang::CodeGen::LValue, bool, clang::SourceLocation) + 88
10 clang     0x00000000806b7d1c
(clang::CodeGen::CGFunctionInfo const&, bool, clang::SourceLocation) + 1180
11 clang     0x00000000805ef866
clang::CodeGen::CodeGenFunction::FinishFunction(clang::SourceLocation) +
12 clang     0x00000000805f37be
llvm::Function*, clang::CodeGen::CGFunctionInfo const&) + 798

The call in EmitFunctionEpilog is from here:

  case ABIArgInfo::Indirect: {
    auto AI = CurFn->arg_begin();
    if (RetAI.isSRetAfterThis())
    switch (getEvaluationKind(RetTy)) {
    case TEK_Complex: {
      ComplexPairTy RT =
        EmitLoadOfComplex(MakeNaturalAlignAddrLValue(ReturnValue, RetTy),
      EmitStoreOfComplex(RT, MakeNaturalAlignAddrLValue(AI, RetTy),
                         /*isInit*/ true);

I'm not sure I understand exactly what's going on here, but it looks like
LexicalBlockStack.empty() is simply supposed to be true at this point
during epilog generation?  In that case, the assertion would always
fail ...

I'm assuming this happens only on SystemZ because it is one of the few
platforms that return complex values via implicit reference.

Any suggestions how to fix this?  Thanks!

Mit freundlichen Gruessen / Best Regards

Ulrich Weigand

  Dr. Ulrich Weigand | Phone: +49-7031/16-3727
  STSM, GNU/Linux compilers and toolchain
  IBM Deutschland Research & Development GmbH
  Vorsitzende des Aufsichtsrats: Martina Koederitz | Geschäftsführung: Dirk
  Sitz der Gesellschaft: Böblingen | Registergericht: Amtsgericht
Stuttgart, HRB 243294

More information about the cfe-commits mailing list