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: unassignedb...@nondot.org
          Reporter: kdes...@insa-rennes.fr
                CC: htmldevelo...@gmail.com, llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to