<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 - Clang Segmentation Fault with 2D Array."
   href="https://bugs.llvm.org/show_bug.cgi?id=46639">46639</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang Segmentation Fault with 2D Array.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>10.0
          </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>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>kdesnos@insa-rennes.fr
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=23704" name="attach_23704" title="cpp and sh files generated before dump.">attachment 23704</a> <a href="attachment.cgi?id=23704&action=edit" title="cpp and sh files generated before dump.">[details]</a></span>
cpp and sh files generated before dump.

Hi,

When using 2D array with clang, I found a way to cause a segmentation fault of
the clang compiler (checked 10 on my WSL) and on the trunk version with
godbolt.

The minimal example is the following :
```
 class A {
         public:
         ~A(){} // No custom destructor => No error
 };

int main() {

  auto a = new A[2][3];

  A (*b) [] = (A (*)[])a; // Adding dimension [3] solves the error too.

  delete[] b;

  return 0;
}

```

This code compiles without warning nor errors with MSVC 19.24 and gcc 7.5. I do
not mind the error or warning from clang, but the seg fault that follows is an
issue.

Attached is the cpp and sh generated by clang on crash.

Best,

Karol</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>