[llvm-commits] [llvm] r170652 - /llvm/trunk/include/llvm/ADT/APSInt.h

Richard Smith richard-llvm at metafoo.co.uk
Wed Dec 19 19:59:24 PST 2012


Author: rsmith
Date: Wed Dec 19 21:59:24 2012
New Revision: 170652

URL: http://llvm.org/viewvc/llvm-project?rev=170652&view=rev
Log:
Don't leave IsUnsigned uninitialized in a default-constructed APSInt. Copying
such a structure has undefined behavior. Caught by -fsanitize=bool.

Modified:
    llvm/trunk/include/llvm/ADT/APSInt.h

Modified: llvm/trunk/include/llvm/ADT/APSInt.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APSInt.h?rev=170652&r1=170651&r2=170652&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/APSInt.h (original)
+++ llvm/trunk/include/llvm/ADT/APSInt.h Wed Dec 19 21:59:24 2012
@@ -23,7 +23,7 @@
   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.





More information about the llvm-commits mailing list