I'm experiencing a weird issue during .ll file parsing, and I'm not sure if it's a bug in the .ll parser, or if I'm just not understanding the IR.<div><br></div><div>Take the following IR:</div><div><br></div>
<div><div><font face="courier new, monospace">@a = addrspace(1) global i8 0</font></div><div><font face="courier new, monospace">@a2 = global i8 addrspace(1)* @a</font></div><div><br></div><div>This parses fine.  But if I rearrange the statements to:</div>
<div><br></div><div><div><font face="courier new, monospace">@a2 = global i8 addrspace(1)* @a</font></div><div><font face="courier new, monospace">@a = addrspace(1) global i8 0</font></div></div><div><br></div><div>then I get an ugly assertion failure:</div>
<div><br></div><div><font face="courier new, monospace">Assertion failed: (InitVal->getType() == getType()->getElementType() && "Initializer type must match GlobalVariable type"), function setInitializer, file /Users/jholewinski/projects/llvm/src/llvm/lib/VMCore/Globals.cpp, line 168.</font><br>
</div><div><br></div><div>Looking at the debugger, I see that InitVal (the initializer for @a2) has type i8*, which looks incorrect as it drops the addrspace from the definition of @a.</div><div><br></div><div>Before I go too far into this, should this IR work?  It looks like the parser is failing to properly process the forward declaration of @a, but I just want to be sure.</div>
<div><br></div>-- <br><br><div>Thanks,</div><div><br></div><div>Justin Holewinski</div><br>
</div>