[cfe-commits] [PATCH] Fixed SrcMgr::FileInfo pointer magic issue in getContentCache()

Dmitri Gribenko gribozavr at gmail.com
Wed Nov 14 11:22:53 PST 2012


On Tue, Nov 13, 2012 at 10:47 AM, Riku Palomäki <riku at multitouch.fi> wrote:
> uintptr_t SrcMgr::FileInfo::Data is used to store both a pointer value
> and some additional flags. getContentCache-function tries to get only
> the raw pointer value from Data, but fails to do so since it uses
> wrong size int. At least on Windows 8 with 64-bit Visual Studio 2012
> this function always returns corrupted pointers.
>
> On some platforms unsigned long long would be actually too large for
> this use. If this triggers a warning on gcc, maybe it should be
> written like ~uintptr_t(7UL).

Wouldn't it be better to use a PointerIntPair and avoid the issue altogether?

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/




More information about the cfe-commits mailing list