<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Dec 7, 2014 at 9:31 PM, Chengyu Song <span dir="ltr"><<a href="mailto:csong84@gatech.edu" target="_blank">csong84@gatech.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="">> It's difficult to say without a full example, but I'm very suspicious<br>
> of those global declarations. I think the compiler would be entirely<br>
> justified in assuming you could *never* get from __start_builtin_fw to<br>
> __end_builtin_fw, let alone on the first iteration: they're distinct<br>
> array objects and by definition (within C99) can't overlap.<br>
<br>
</span>I think this should be the root cause. Once I changed the declaration to pointers (instead of arrays):<br>
<br>
extern struct builtin_fw* __start_builtin_fw;<br>
extern struct builtin_fw* __end_builtin_fw;<br>
<br>
The generated code will not skip the first comparison.<br></blockquote><div><br></div><div>I don't think this code means the same thing. AFAIK this code says that there is a pointer (to struct builtin_fw) in memory at __start_builtin_fw, whereas the original code says that there is a `struct builtin_fw` (or zero of them) in memory at __start_builtin_fw.</div><div><br></div><div>-- Sean Silva</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
Sadly, Linux kernel may contain more such declarations.<br>
<br>
Thanks a lot!<br>
<span class=""><font color="#888888">Chengyu<br>
</font></span><div class=""><div class="h5">_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</div></div></blockquote></div><br></div></div>