> > > > Is there some code checker which could point out those "violations"? > > Paul's right, valgrind is almost certainly the right tool for that. > clang/llvm usually does a pretty good job of identifying obscure cases > like this, but it will be a while before I can get that set up as I'm > currently in the middle of some non-trivial work stuff. When I have time > I'll post a clang build log. > > I'm not sure valgrind would work, since its not going to be accessing memory that is invalid.
This is something that should probably be detected by a compiler. Try compiling it with a 64 bit compiler. Then it'll be comparing a 64 bit address to a 32 bit integer (zero). You might/should be able to get gcc to complain. Dunno about clang, i'd like to try that myself sometime.
