[PATCH] [UBSan][MIPS] Use unsigned value while bit shifting on MIPS

Sagar Thakur Sagar.Thakur at imgtec.com
Tue Apr 28 03:12:03 PDT 2015


> Please elaborate what's going on here (i.e. what is the value that we fail to sign-extend)?


The value that we fail to sign extend is of `SIntMax(Val)`. We are getting uncertain results on bit shifting of signed types. Therefore we need to use unsigned types when applying bit shifting. Since return type of `getSIntValue()` function is `SIntMax`, we can type cast the return value after bit shifting to `SIntMax`.

> This code looks far too complex to me, and I'd strongly suggest to make it platform-independent.


I have tried to simplify the code and make it platform independent. I will update this patch with the simplified code


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D9247

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list