[openib-general] Re: ibv_get_device_guid() not byte swapping

Roland Dreier rolandd at cisco.com
Tue Sep 6 14:47:21 PDT 2005


    Sean> Has anyone else seen errors with byte swapping in
    Sean> ibv_get_device_guid()?  I'm seeing a condition where the
    Sean> initial 2-bytes of the GUID are not swapped.  The actual
    Sean> code in device.c appears to be correct, and if I insert a
    Sean> printf before returning from the call, then the returned
    Sean> GUID is correct.  (I'm using SuSE, with gcc 3.3.3.)

I haven't seen that, but it certainly looks like something
optimization-related.  I'm not sure if it's a compiler bug or a bug in
the libibverbs code.  I don't think the code violates any pointer
aliasing rules, but I'm not enough of a C lawyer to be positive.

Perhaps changing the guid to a union is the easiest thing to do.

 - R.



More information about the general mailing list