Add assert to catch an attempt to emit .byte 256
authorDevang Patel <dpatel@apple.com>
Thu, 9 Dec 2010 19:26:21 +0000 (19:26 +0000)
committerDevang Patel <dpatel@apple.com>
Thu, 9 Dec 2010 19:26:21 +0000 (19:26 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121402 91177308-0d34-0410-b5e6-96231b3b80d8

lib/MC/MCStreamer.cpp

index 096cea7bc7f10144763095c5c2d6df15dcee902f..e003a953adec380a823c5c90acffdec0ba7fab65 100644 (file)
@@ -47,7 +47,8 @@ void MCStreamer::EmitDwarfSetLineAddr(int64_t LineDelta,
 /// pass in a MCExpr for constant integers.
 void MCStreamer::EmitIntValue(uint64_t Value, unsigned Size,
                               unsigned AddrSpace) {
-  assert(Size <= 8);
+  assert(Size <= 8 && "Invalid size");
+  assert(!(Size == 1 && (signed)Value > 255) && "Invalid size");
   char buf[8];
   // FIXME: Endianness assumption.
   for (unsigned i = 0; i != Size; ++i)