[cfe-dev] Relational operators on pointers
eli.friedman at gmail.com
Wed Oct 12 16:11:48 PDT 2011
On Wed, Oct 12, 2011 at 3:13 PM, Stefan Marr
<mailinglists at stefan-marr.de> wrote:
> On 12 Oct 2011, at 23:54, David Chisnall wrote:
>> So, if you want to do a comparison between two unrelated pointers as unsigned values, the safest thing to do is cast them to uintptr_t and then do the comparison.
> Right, done, and failed. In this particular case, as Eli pointed out, some optimization is applied.
We shouldn't be messing with integer comparisons...
> All my casting to what ever type, and with whatever mechanism, did not help.
> Not even using temp variables of 64bit types with which ever signage.
> That all got just optimized away...
> Leaving me with a failing test without apparent reason.
What version of clang are you using?
More information about the cfe-dev