<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 - CallExpr::getArgs violates strict aliasing"
   href="https://bugs.llvm.org/show_bug.cgi?id=43344">43344</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>CallExpr::getArgs violates strict aliasing
          </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>All
          </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>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>comexk@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>For a CallExpr, the array trailing the object can be accessed in two different
ways:

- As `Stmt **`: getTrailingStmts(), children()
- As `Expr **`: getArgs()

Accessing the same memory using both types is a strict aliasing violation –
it's of course legal to access an `Expr` through a pointer to `Stmt`, but not
to access an `Expr *` through a pointer to `Stmt *` or vice versa.

However, note that Clang itself does not enforce strict aliasing between
pointer types [1], and Clang's build system sets -fno-strict-aliasing when
built with GCC-compatible compilers other than Clang itself [2].  And the other
major C++ compiler, MSVC, does not enforce strict aliasing at all.  So for now
this should not cause any problems in practice.

[1]
<a href="https://github.com/llvm-mirror/clang/blob/168f5196982f3aa5abce4e28c75bd6194ce0d9f0/lib/CodeGen/CodeGenTBAA.cpp#L161">https://github.com/llvm-mirror/clang/blob/168f5196982f3aa5abce4e28c75bd6194ce0d9f0/lib/CodeGen/CodeGenTBAA.cpp#L161</a>
[2]
<a href="https://github.com/llvm-mirror/clang/blob/168f5196982f3aa5abce4e28c75bd6194ce0d9f0/CMakeLists.txt#L363">https://github.com/llvm-mirror/clang/blob/168f5196982f3aa5abce4e28c75bd6194ce0d9f0/CMakeLists.txt#L363</a></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>