[llvm-dev] Crash in SmallVector with latest MSVC 2019 (debug mode)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[llvm-dev] Crash in SmallVector with latest MSVC 2019 (debug mode)

Sriraman Tallam via llvm-dev
Is anybody using the LLVM/clang/lldb compiled with the MSVC 2019 (x86-32bit) successfully?
I am getting crash in SmallVector at multiple places after a llvm:SmallVector is being moved around in move constructor or move operator=.
 Not sure what is going on.

  ~SmallVectorImpl() {
    if (!this->isSmall())
      free(this->begin());  // <=== crash here, line 336 SmallVector.h
  }

The crash occurs only with clang compile in debug mode. Release mode is fine. 


_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] Crash in SmallVector with latest MSVC 2019 (debug mode)

Sriraman Tallam via llvm-dev
> The crash occurs only with clang compile in debug mode.

Sanity check: you're not mixing clang in debug mode with LLVM in release mode, right?
I've seen similar crashes in DenseMap when I *accidentally* did the above.

From: llvm-dev <[hidden email]> on behalf of Francois Pichet via llvm-dev <[hidden email]>
Sent: Wednesday, January 22, 2020 1:00 PM
To: [hidden email] <[hidden email]>
Subject: [llvm-dev] Crash in SmallVector with latest MSVC 2019 (debug mode)
 
Is anybody using the LLVM/clang/lldb compiled with the MSVC 2019 (x86-32bit) successfully?
I am getting crash in SmallVector at multiple places after a llvm:SmallVector is being moved around in move constructor or move operator=.
 Not sure what is going on.

  ~SmallVectorImpl() {
    if (!this->isSmall())
      free(this->begin());  // <=== crash here, line 336 SmallVector.h
  }

The crash occurs only with clang compile in debug mode. Release mode is fine. 


_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] Crash in SmallVector with latest MSVC 2019 (debug mode)

Sriraman Tallam via llvm-dev
In reply to this post by Sriraman Tallam via llvm-dev
I don't think there is anymore upstream LLVM testing for 32-bit MSVC. I'll run a local build in this configuration and look into it. I'll use this compiler version:
Microsoft (R) C/C++ Optimizing Compiler Version 19.24.28315 for x86

We had so many issues in clang-cl around calling conventions for "small" objects with interior pointers, I wouldn't be surprised if there are bugs.

On Wed, Jan 22, 2020 at 10:01 AM Francois Pichet via llvm-dev <[hidden email]> wrote:
Is anybody using the LLVM/clang/lldb compiled with the MSVC 2019 (x86-32bit) successfully?
I am getting crash in SmallVector at multiple places after a llvm:SmallVector is being moved around in move constructor or move operator=.
 Not sure what is going on.

  ~SmallVectorImpl() {
    if (!this->isSmall())
      free(this->begin());  // <=== crash here, line 336 SmallVector.h
  }

The crash occurs only with clang compile in debug mode. Release mode is fine. 

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] Crash in SmallVector with latest MSVC 2019 (debug mode)

Sriraman Tallam via llvm-dev
I was able to reproduce the problem. It seems to relate to the use of a UniqueVector (which uses std::vector internally) of SmallVectors here:
https://github.com/llvm/llvm-project/blob/master/llvm/utils/TableGen/DFAEmitter.h#L91  
Aside from potential MSVC bugs, this is a poor choice of data structures. I would suggest using a SmallVector<T, 0> or std::vector<T> instead. So, we could commit that as a workaround.

Relatedly, debug MSVC tablegen builds are still unusably slow. :(

On Wed, Jan 22, 2020 at 11:15 AM Reid Kleckner <[hidden email]> wrote:
I don't think there is anymore upstream LLVM testing for 32-bit MSVC. I'll run a local build in this configuration and look into it. I'll use this compiler version:
Microsoft (R) C/C++ Optimizing Compiler Version 19.24.28315 for x86

We had so many issues in clang-cl around calling conventions for "small" objects with interior pointers, I wouldn't be surprised if there are bugs.

On Wed, Jan 22, 2020 at 10:01 AM Francois Pichet via llvm-dev <[hidden email]> wrote:
Is anybody using the LLVM/clang/lldb compiled with the MSVC 2019 (x86-32bit) successfully?
I am getting crash in SmallVector at multiple places after a llvm:SmallVector is being moved around in move constructor or move operator=.
 Not sure what is going on.

  ~SmallVectorImpl() {
    if (!this->isSmall())
      free(this->begin());  // <=== crash here, line 336 SmallVector.h
  }

The crash occurs only with clang compile in debug mode. Release mode is fine. 

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] Crash in SmallVector with latest MSVC 2019 (debug mode)

Sriraman Tallam via llvm-dev
Thank you.

Yes the bug occurs in tablegen first but even if you bypass tablegen-debug it will eventually occur elsewhere too (llvm, lldb etc)..

I'll try to reduce the problem in a isolated test case and submit a bug to Microsoft.
Sadly I am stuck with 32-bit compile for now because we use liblldb.dll and libclang.dll as in-process DLL inside a 32-bit .exe.


(Forgot reply-all)


On Wed, Jan 22, 2020 at 2:25 PM Reid Kleckner <[hidden email]> wrote:
I was able to reproduce the problem. It seems to relate to the use of a UniqueVector (which uses std::vector internally) of SmallVectors here:
https://github.com/llvm/llvm-project/blob/master/llvm/utils/TableGen/DFAEmitter.h#L91  
Aside from potential MSVC bugs, this is a poor choice of data structures. I would suggest using a SmallVector<T, 0> or std::vector<T> instead. So, we could commit that as a workaround.

Relatedly, debug MSVC tablegen builds are still unusably slow. :(

On Wed, Jan 22, 2020 at 11:15 AM Reid Kleckner <[hidden email]> wrote:
I don't think there is anymore upstream LLVM testing for 32-bit MSVC. I'll run a local build in this configuration and look into it. I'll use this compiler version:
Microsoft (R) C/C++ Optimizing Compiler Version 19.24.28315 for x86

We had so many issues in clang-cl around calling conventions for "small" objects with interior pointers, I wouldn't be surprised if there are bugs.

On Wed, Jan 22, 2020 at 10:01 AM Francois Pichet via llvm-dev <[hidden email]> wrote:
Is anybody using the LLVM/clang/lldb compiled with the MSVC 2019 (x86-32bit) successfully?
I am getting crash in SmallVector at multiple places after a llvm:SmallVector is being moved around in move constructor or move operator=.
 Not sure what is going on.

  ~SmallVectorImpl() {
    if (!this->isSmall())
      free(this->begin());  // <=== crash here, line 336 SmallVector.h
  }

The crash occurs only with clang compile in debug mode. Release mode is fine. 

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev