Don't leave IsUnsigned uninitialized in a default-constructed APSInt. Copying
authorRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 20 Dec 2012 03:59:24 +0000 (03:59 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 20 Dec 2012 03:59:24 +0000 (03:59 +0000)
such a structure has undefined behavior. Caught by -fsanitize=bool.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170652 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/APSInt.h

index 048c65ce2c773f00654f0f2a47db54b52ec40689..4a5e7a3918ea0c30441e1508a9df52535b3934c8 100644 (file)
@@ -23,7 +23,7 @@ class APSInt : public APInt {
   bool IsUnsigned;
 public:
   /// Default constructor that creates an uninitialized APInt.
-  explicit APSInt() {}
+  explicit APSInt() : IsUnsigned(false) {}
 
   /// APSInt ctor - Create an APSInt with the specified width, default to
   /// unsigned.