[llvm-dev] ilist/iplist are broken (maybe I'll fix them?)

Duncan P. N. Exon Smith via llvm-dev llvm-dev at lists.llvm.org
Tue Oct 20 11:13:47 PDT 2015

> On 2015-Oct-07, at 17:57, Duncan P. N. Exon Smith <dexonsmith at apple.com> wrote:
> I've been digging into some undefined behaviour stemming from how ilist
> is typically configured.  r247937, r247944, and r247978 caused a UBSan
> failure to start firing on our Green Dragon bots, and after an IRC
> conversation between David and Nick and Mehdi, we added a blacklist:
> --
> $echo "src:$WORKSPACE/llvm/include/llvm/CodeGen/MachineFunction.h" >> sanitize.blacklist
> --
> ilist/iplist is a pretty strange list, and the more I dig into it (to
> fix the UB) the more broken I think it is.
> I want to change a few things about it, but it'll be somewhat
> intrusive (pun not really intended), so I want to get some buy-in before
> really diving in.  I've CC'ed the people in the IRC conversation and a
> couple of others that seem to care about ADT and/or UB.

A quick update on this.

The first problem I hit was that there are callers that *rely* on
`getNextNode()` returning the sentinel instead of `nullptr`.  If you
look at the implementation of `getNextNode()`, that's kind of insane.

The only way I could think to root out all the similar issues was to
look at every call to the implicit conversions and confirm they aren't
doing anything strange.  Most easily done by applying the attached
patch, and getting this compiling again.  I have some more commentary
in, e.g., r249767 and r249782.

Some of the problems I've uncovered include r249758, r249763, r249764,
and more scary cases like r249925 and r250211.

I've almost finished LLVM proper, but I haven't touched clang yet, or
other LLVM projects.

Is there any contention about this?  Do we eventually want to commit
this patch, or should we go back to our old implicit ways once I've
cleaned up ilist and iplist?  (Basically, should we make clang clean
too and commit this patch, or should I just fix the bugs?)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-WIP-HACK-NOT-READY-DO-NOT-COMMIT-explicit-ilist.patch
Type: application/octet-stream
Size: 1120 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151020/e59d1025/attachment.obj>
-------------- next part --------------

More information about the llvm-dev mailing list