<html>
    <head>
      <base href="https://bugs.freedesktop.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 - clang crashes when compiling OpenCL kernel"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=105869">105869</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang crashes when compiling OpenCL kernel
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Mesa
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>git
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Drivers/Gallium/radeonsi
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>dri-devel@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>vedran@miletic.net
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>dri-devel@lists.freedesktop.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>(from #radeon and <a href="https://paste.debian.net/1018363/">https://paste.debian.net/1018363/</a>)

When compiling the following OpenCL kernel

kernel void PulseWave(global float* buffer, size_t num_harmonics,
        float duty_cycle)
{
        size_t index = get_global_id(0);
        float phase = buffer[index];
        float sample = duty_cycle;
        float precompute1 = (phase - duty_cycle / 2.0) * 2.0 * M_PI;
        for (size_t i = 1; i <= num_harmonics; ++i)
        {
                float harmonic = 2.0 / (i * M_PI) * sin(M_PI * i * duty_cycle)
*
                        cos(i * precompute1);
                sample += harmonic;
        }
        buffer[index] = sample * 2.0 - 1.0;
}

Clang will crash with

Thread 1 "ftz_chiptune_pu" received signal SIGSEGV, Segmentation fault.
0x00007fffe6501ba1 in llvm::LiveRange::find(llvm::SlotIndex) () from
/usr/lib/x86_64-linux-gnu/libLLVM-5.0.so.1
(gdb) bt
#0  0x00007fffe6501ba1 in llvm::LiveRange::find(llvm::SlotIndex) () from
/usr/lib/x86_64-linux-gnu/libLLVM-5.0.so.1
#1  0x00007fffe66674a1 in ?? () from /usr/lib/x86_64-linux-gnu/libLLVM-5.0.so.1
#2  0x00007fffe66676c1 in ?? () from /usr/lib/x86_64-linux-gnu/libLLVM-5.0.so.1
#3  0x00007fffe66697e5 in llvm::RegPressureTracker::getLiveThroughAt(unsigned
int, llvm::SlotIndex) const () from /usr/lib/x86_64-linux-gnu/libLLVM-5.0.so.1
#4  0x00007fffe6669af1 in
llvm::RegPressureTracker::recede(llvm::RegisterOperands const&,
llvm::SmallVectorImpl<llvm::RegisterMaskPair>*) ()
   from /usr/lib/x86_64-linux-gnu/libLLVM-5.0.so.1
#5  0x00007fffe66a0229 in
llvm::ScheduleDAGInstrs::buildSchedGraph(llvm::AAResults*,
llvm::RegPressureTracker*, llvm::PressureDiffs*, llvm::LiveIntervals*, bool) ()
from /usr/lib/x86_64-linux-gnu/libLLVM-5.0.so.1
#6  0x00007fffe65e7653 in llvm::ScheduleDAGMILive::buildDAGWithRegPressure() ()
from /usr/lib/x86_64-linux-gnu/libLLVM-5.0.so.1
#7  0x00007fffe65e76b9 in llvm::ScheduleDAGMILive::schedule() () from
/usr/lib/x86_64-linux-gnu/libLLVM-5.0.so.1
#8  0x00007fffe758e501 in llvm::GCNScheduleDAGMILive::schedule() () from
/usr/lib/x86_64-linux-gnu/libLLVM-5.0.so.1
#9  0x00007fffe758e26e in llvm::GCNScheduleDAGMILive::finalizeSchedule() ()
from /usr/lib/x86_64-linux-gnu/libLLVM-5.0.so.1
#10 0x00007fffe65e6fa7 in ?? () from /usr/lib/x86_64-linux-gnu/libLLVM-5.0.so.1
#11 0x00007fffe657cae0 in
llvm::MachineFunctionPass::runOnFunction(llvm::Function&) () from
/usr/lib/x86_64-linux-gnu/libLLVM-5.0.so.1
#12 0x00007fffe63deac8 in llvm::FPPassManager::runOnFunction(llvm::Function&)
() from /usr/lib/x86_64-linux-gnu/libLLVM-5.0.so.1
#13 0x00007fffe6fb7b50 in ?? () from /usr/lib/x86_64-linux-gnu/libLLVM-5.0.so.1
#14 0x00007fffe63de3af in llvm::legacy::PassManagerImpl::run(llvm::Module&) ()
from /usr/lib/x86_64-linux-gnu/libLLVM-5.0.so.1
#15 0x00007ffff42227ce in ?? () from
/usr/lib/x86_64-linux-gnu/libMesaOpenCL.so.1
#16 0x00007ffff4222ed0 in ?? () from
/usr/lib/x86_64-linux-gnu/libMesaOpenCL.so.1
#17 0x00007ffff421e6a7 in ?? () from
/usr/lib/x86_64-linux-gnu/libMesaOpenCL.so.1
#18 0x00007ffff420fea1 in ?? () from
/usr/lib/x86_64-linux-gnu/libMesaOpenCL.so.1
#19 0x00007ffff41efe02 in ?? () from
/usr/lib/x86_64-linux-gnu/libMesaOpenCL.so.1
#20 0x0000555555561129 in cl::Program::build (this=0x7fffffffde10, options=0x0,
notifyFptr=0x0, data=0x0) at /usr/include/CL/cl2.hpp:6321</pre>
        </div>
      </p>


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

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>