[llvm-commits] [LLVM, PR11652 PATCH]: Fixed Bug 11652 - assertion failures when Type.cpp is compiled with -Os
Stepan Dyatkovskiy
STPWORLD at narod.ru
Mon Jan 2 01:56:00 PST 2012
ping.
-Stepan.
30.12.2011, 23:41, "Stepan Dyatkovskiy" <stpworld at narod.ru>:
> The problem is in Type.h. The fields in Type class are declared in next
> order:
> TypeID ID : 8;
> unsigned SubclassData : 24;
> unsigned NumContainedTys;
>
> Attempt to set new SubclassData value rewrites lowest byte in
> NumContainedTys when -Os is set. GCC bug? Anyway setting SubclassData
> with two workaround strings fixes the problem:
>
> void setSubclassData(unsigned val) {
> unsigned tmp = NumContainedTys; // Workaround for GCC -Os
> SubclassData = val;
> NumContainedTys = tmp; // Workaround for GCC -Os
> // Ensure we don't have any accidental truncation.
> assert(SubclassData == val && "Subclass data too large for field");
> }
>
> Probably there is another ways to protect NumContainedTys from overwritting?
>
> Please find the patch in attachment for review.
>
> -Stepan.
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list