<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 - Failure casting from __generic to __global address space when variable is volatile"
   href="https://bugs.llvm.org/show_bug.cgi?id=41567">41567</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Failure casting from __generic to __global address space when variable is volatile
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

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

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

        <tr>
          <th>OS</th>
          <td>Linux
          </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>OpenCL
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>drohr@jwdt.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>anastasia.stulova@arm.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=21815" name="attach_21815" title="Failing test case">attachment 21815</a> <a href="attachment.cgi?id=21815&action=edit" title="Failing test case">[details]</a></span>
Failing test case

The attached test_case (test_fail.cl) attempts to cast a volatile int* to
__global volatile int*, it fails compilation with clang 9 (commit
4b56b8f9df9d7fe4ee69f56fc4726910a4a72b04) with the following error message:

test_fail.cl:3:50: error: internal error: could not emit constant value
"abstractly"
    atomic_add((__global volatile unsigned int*) a, 1);

The modified test case (test_work.cl), which only has the volatile keyword
removed, works.

Command line is: clang++ -cl-std=c++ -x cl -cl-denorms-are-zero -cl-mad-enable
-cl-no-signed-zeros -Xclang -finclude-default-header -c test_fail.cl -o test.o

Background: Following the discussion on
<a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - Clang internal error during compilation of OpenCL C++ code"
   href="show_bug.cgi?id=40778">https://bugs.llvm.org/show_bug.cgi?id=40778</a>, I changed my code to have
different functions for old-style atomic operations on __global and __local
address space. During that process, I came across this issue.</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>