diff --git a/docs/LangRef.html b/docs/LangRef.html index 8994a3559fb..1beb670765d 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -1729,7 +1729,8 @@ following is the syntax for constant expressions:

was stored to memory and read back as TYPE. In other words, no bits change with this operator, just the type. This can be used for conversion of vector types to any other type, as long as they have the same bit width. For - pointers it is only valid to cast to another pointer type. + pointers it is only valid to cast to another pointer type. It is not valid + to bitcast to or from an aggregate type.
getelementptr ( CSTPTR, IDX0, IDX1, ... )
@@ -3808,8 +3809,9 @@ nothing is done (no-op cast).

Arguments:

The 'bitcast' instruction takes a value to cast, which must be -a first class value, and a type to cast it to, which must also be a first class type. The bit sizes of value +a non-aggregate first class value, and a type to cast it to, which must also be +a non-aggregate first class type. The bit sizes of +value and the destination type, ty2, must be identical. If the source type is a pointer, the destination type must also be a pointer. This instruction supports bitwise conversion of vectors to integers and to vectors diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index aa6963d94a2..805fb2564a4 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -883,6 +883,12 @@ void Verifier::visitBitCastInst(BitCastInst &I) { "Bitcast requires both operands to be pointer or neither", &I); Assert1(SrcBitSize == DestBitSize, "Bitcast requies types of same width", &I); + // Disallow aggregates. + Assert1(!SrcTy->isAggregateType(), + "Bitcast operand must not be aggregate", &I); + Assert1(!DestTy->isAggregateType(), + "Bitcast type must not be aggregate", &I); + visitInstruction(I); }