On 11/18/2015 11:46 AM, Markus Armbruster wrote:
> Eric Blake <ebl...@redhat.com> writes:
> 
>> Previously, working with alternates required two lookup arrays
>> and some indirection: for type Foo, we created Foo_qtypes[]
>> which maps each qtype to a value of the generated FooKind enum,
>> then look up that value in FooKind_lookup[] like we do for other
>> union types.
>>
>> This has a couple of subtle bugs.  First, the generator was
>> creating a call with a parameter '(int *) &(*obj)->type' where
>> type is an enum type; this is unsafe if the compiler chooses
>> to store the enum type in a different size than int, where
>> assigning through the wrong size pointer can corrupt data or
>> cause a SIGBUS.  [We still have the casting bug for our enum
>> visitors, but that's a topic for a different patch.]
> 
> I'm not sure I get the last sentence.

I was referring to our casts of enum types to int* inside visit_type_Enum():
https://lists.gnu.org/archive/html/qemu-devel/2015-11/msg03408.html

If you have a better wording for it, or want to drop the parenthetical
altogether, I'm fine.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to