MC: Initialize MCSymbolData::Offset directly
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Thu, 21 May 2015 01:59:58 +0000 (01:59 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Thu, 21 May 2015 01:59:58 +0000 (01:59 +0000)
Try to fix miscompile after r237873.  Looks like this union
initialization isn't legal (or at least not supported).

llvm-svn: 237875

llvm/include/llvm/MC/MCSymbol.h

index 26b416e..6f396a5 100644 (file)
@@ -37,7 +37,7 @@ class MCSymbolData {
   union {
     /// Offset - The offset to apply to the fragment address to form this
     /// symbol's value.
-    uint64_t Offset = 0;
+    uint64_t Offset;
 
     /// CommonSize - The size of the symbol, if it is 'common'.
     uint64_t CommonSize;
@@ -60,6 +60,8 @@ class MCSymbolData {
   uint64_t Index = 0;
 
 public:
+  MCSymbolData() { Offset = 0; }
+
   MCFragment *getFragment() const { return Fragment.getPointer(); }
   void setFragment(MCFragment *Value) { Fragment.setPointer(Value); }