[llvm-bugs] [Bug 37551] New: crash at conditional operator with builtins returning void

via llvm-bugs llvm-bugs at lists.llvm.org
Tue May 22 08:40:43 PDT 2018


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

            Bug ID: 37551
           Summary: crash at conditional operator with builtins returning
                    void
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: eugvelesevich at gmail.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 20329
  --> https://bugs.llvm.org/attachment.cgi?id=20329&action=edit
run test

Originally clang crashed at inputmethod package from tizen(inputmethod.cpp)
But I reduced it to:

void get(void* g) {
    g ? __builtin_prefetch(g, 0, 1) : __builtin_prefetch(g, 0, 1);
}

and found a reason.

In ScalarExprEmitter::VisitAbstractConditionalOperator from CGExprScalar.cpp
phi instruction with void type is created. In case not-builtin function call
LHS or RHS are null and the instruction isn't created. But in case of builtin
functions the LHS is a void type llvm::Value created in
CodeGenFunction::EmitBuiltinExpr from CGBuiltin.cpp.

I think it's necessary to check builtins with void return type and replace
return expressions with null in CodeGenFunction::EmitBuiltinExpr.

-- 
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/20180522/26d293b8/attachment.html>


More information about the llvm-bugs mailing list