<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Assertion `(!CombinedExpr || CombinedExpr->isValid()) && "Combined debug expression is invalid"' failed"
   href="https://bugs.llvm.org/show_bug.cgi?id=45181">45181</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Assertion `(!CombinedExpr || CombinedExpr->isValid()) && "Combined debug expression is invalid"' failed
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>DebugInfo
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>david.stenberg@ericsson.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>jdevlieghere@apple.com, keith.walker@arm.com, llvm-bugs@lists.llvm.org, paul_robinson@playstation.sony.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Found by Manoj Gupta.

<a href="https://reviews.llvm.org/D73534#1918890">https://reviews.llvm.org/D73534#1918890</a>

File:

struct type *a(type *, type *, long, long);
enum b {};
static int empty_array(type *, int c) { type *d = a(__null, d, c, c - 1); }
long e;
b f() { empty_array(0, e); }

Command:

$ clang -cc1 -triple x86_64-linux-gnu -emit-obj -disable-free
-mrelocation-model pic -pic-level 2 -pic-is-pie -mthread-model posix
-mframe-pointer=all -mconstructor-aliases -munwind-tables -dwarf-column-info
-debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -O2 -x c++

gives:

clang:
/home/edasten/upstream/monorepo/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp:630:
void addToFwdRegWorklist(FwdRegWorklist&, unsigned int, const
llvm::DIExpression*, llvm::ArrayRef<FwdRegParamInfo>): Assertion
`CombinedExpr->isValid() && "Combined debug expression is invalid"' failed.
Stack dump:
0.      Program arguments: ./build/bin/clang -cc1 -triple x86_64-linux-gnu
-emit-obj -disable-free -mrelocation-model pic -pic-level 2 -pic-is-pie
-mthread-model posix -mframe-pointer=all -mconstructor-aliases -munwind-tables
-dwarf-column-info -debug-info-kind=limited -dwarf-version=4
-debugger-tuning=gdb -O2 -x c++ combined.c 
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'combined.c'.
4.      Running pass 'X86 Assembly Printer' on function
'@_ZL11empty_arrayP4typei'

The invalid DIExpression is produced by appending together the following two
expressions:

Expr: !DIExpression(DW_OP_LLVM_convert, 32, DW_ATE_signed, DW_OP_LLVM_convert,
64, DW_ATE_signed, DW_OP_stack_value)
Param.Expr: !DIExpression(DW_OP_constu, 1, DW_OP_minus, DW_OP_LLVM_convert, 32,
DW_ATE_signed, DW_OP_LLVM_convert, 64, DW_ATE_signed, DW_OP_stack_value)

That results in a DW_OP_stack_value being in the middle of a DIExpression,
which is invalid.

The DW_OP_stack_values are added to the expressions due to use of
DIExpression::appendExt() which in turn uses appendToStack(). I don't think
that the describeLoadedValue() hook should return DIExpressions using
DW_OP_stack_value, since that will be used to produce DW_AT_call_values, which
are implicitly stack operations.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>