[llvm-bugs] [Bug 30219] New: [OpenCL 2.0] Wrong implicit cast from pipe built-in functions.

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Aug 31 01:59:28 PDT 2016


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

            Bug ID: 30219
           Summary: [OpenCL 2.0] Wrong implicit cast from pipe built-in
                    functions.
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: OpenCL
          Assignee: unassignedclangbugs at nondot.org
          Reporter: aleksey.bader at mail.ru
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Here is an example that exposes the issue:

__kernel void testKernel(__global int *status, write_only pipe int tested_pipe)
{
    *status = 0;
    int value = 2;

    if (write_pipe(tested_pipe, &value)) { *status = 2; return; }
}

Error message I get in Release mode on the trunk:

Branch condition is not 'i1' type!
  br i32 %5, label %6, label %8
  %5 = call i32 @__write_pipe_2(%opencl.pipe_t addrspace(1)* %3, i8
addrspace(4)* %4, i32 4, i32 4)
fatal error: error in backend: Broken function found, compilation aborted!

In Debug mode clang crashes in
clang::CodeGen::CodeGenFunction::EmitBranchOnBoolExpr function.

It looks like a bug in the parser. Here is the expression passed to that
function:
CallExpr 0x7aed540 '_Bool'
|-ImplicitCastExpr 0x7aed528 'int (*)()' <BuiltinFnToFnPtr>
| `-DeclRefExpr 0x7aed438 '<builtin fn type>' Function 0x7aed358 'write_pipe'
'int ()'
|-DeclRefExpr 0x7aed460 'pipe int' lvalue ParmVar 0x7aecfe0 'tested_pipe' 'pipe
int'
`-UnaryOperator 0x7aed4d8 'int *' prefix '&'
  `-DeclRefExpr 0x7aed488 'int' lvalue Var 0x7aed298 'value' 'int'

This looks wrong. There should be built-in call and implicit cast of resulting
integer to boolean value.

-- 
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/20160831/7cb06fb2/attachment-0001.html>


More information about the llvm-bugs mailing list