[PATCH] Fix for aggregate copying of variable length arrays.
a.bataev at hotmail.com
Tue May 19 06:41:03 PDT 2015
Patch fixes codegen for aggregate copying of VLAs. Currently method CodeGenFunction::EmitAggregateCopy() does not support copying of VLAs. Patch checks if the size of the type is 0, then checks if the type is actually a variable-length array. Then it calculates total length for this array and calculates total size of the array in bytes:
<total number of elements in array> * aligned_sizeof(ElementType) (if copy assignment is requested).
If simple copying is requested, size is calculated like:
<total number of elements in array> * aligned_sizeof(ElementType) - aligned_sizeof(ElementType) + sizeof(ElementType).
memcpy() is used with this calculated size of the VLA.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 5098 bytes
Desc: not available
More information about the cfe-commits