While I testing some code, I found some problem on Union handling.
I've wrte following test code, and it has union assignment.
The code's output is
from pointerToUnion: chars mystring, length 64
from original: chars mystring, length 8000
It's caused by second char member(charlength) of LongestMember.
For union assignment, llvm-backend seems generates assigning each
member of largest union member. (I've checked it on llvm assembly
level..)
But sometimes there is padding between members and it's different for members.
So in my opinion you should handle union assignment as pseudo array of
word(or byte).
(it's same for argument passing..)
While I testing some code, I found some problem on Union handling.
I've wrte following test code, and it has union assignment.
BTW, this is fixed in mainline now. Thanks for the report.
-Chris
The code's output is
from pointerToUnion: chars mystring, length 64
from original: chars mystring, length 8000
It's caused by second char member(charlength) of LongestMember.
For union assignment, llvm-backend seems generates assigning each
member of largest union member. (I've checked it on llvm assembly
level..)
But sometimes there is padding between members and it's different for members.
So in my opinion you should handle union assignment as pseudo array of
word(or byte).
(it's same for argument passing..)