forked from OSchip/llvm-project
Don't use -1 as a value of an unsigned 7-bit enumeration; that has undefined
behavior and violates the !range constraints we put on loads of this enum. Found by clang -fsanitize=enum. llvm-svn: 170653
This commit is contained in:
parent
3287fac591
commit
e7701ebfec
|
@ -39,6 +39,7 @@ class ArrayRef;
|
|||
|
||||
/// Enum used to categorize the alignment types stored by LayoutAlignElem
|
||||
enum AlignTypeEnum {
|
||||
INVALID_ALIGN = 0, ///< An invalid alignment
|
||||
INTEGER_ALIGN = 'i', ///< Integer type alignment
|
||||
VECTOR_ALIGN = 'v', ///< Vector type alignment
|
||||
FLOAT_ALIGN = 'f', ///< Floating point type alignment
|
||||
|
|
|
@ -118,8 +118,7 @@ LayoutAlignElem::operator==(const LayoutAlignElem &rhs) const {
|
|||
}
|
||||
|
||||
const LayoutAlignElem
|
||||
DataLayout::InvalidAlignmentElem =
|
||||
LayoutAlignElem::get((AlignTypeEnum) -1, 0, 0, 0);
|
||||
DataLayout::InvalidAlignmentElem = LayoutAlignElem::get(INVALID_ALIGN, 0, 0, 0);
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// PointerAlignElem, PointerAlign support
|
||||
|
|
Loading…
Reference in New Issue