[llvm-bugs] [Bug 46639] New: Clang Segmentation Fault with 2D Array.

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jul 8 08:15:07 PDT 2020


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

            Bug ID: 46639
           Summary: Clang Segmentation Fault with 2D Array.
           Product: new-bugs
           Version: 10.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: kdesnos at insa-rennes.fr
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

Created attachment 23704
  --> https://bugs.llvm.org/attachment.cgi?id=23704&action=edit
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

-- 
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/20200708/86b02a86/attachment.html>


More information about the llvm-bugs mailing list