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: unassignedclangb...@nondot.org
          Reporter: eugvelesev...@gmail.com
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to