[ovs-git] [openvswitch/ovs] 11d9ad: test-hash: Fix unaligned pointer value error.

GitHub noreply at github.com
Wed Jun 7 21:53:31 UTC 2017


  Branch: refs/heads/master
  Home:   https://github.com/openvswitch/ovs
  Commit: 11d9ad2db8b41e51d9121535ce053c1d9e4c266d
      https://github.com/openvswitch/ovs/commit/11d9ad2db8b41e51d9121535ce053c1d9e4c266d
  Author: Joe Stringer <joe at ovn.org>
  Date:   2017-06-07 (Wed, 07 Jun 2017)

  Changed paths:
    M tests/test-hash.c

  Log Message:
  -----------
  test-hash: Fix unaligned pointer value error.

Clang 4.0 complains:

../tests/test-hash.c:160:16: error: taking address of packed member 'b' of
class or structure 'offset_ovs_u128' may result in an unaligned pointer value
      [-Werror,-Waddress-of-packed-member]
  in0 = &in0_data.b;

Set the bit in the aligned u128 first then copy the contents into the
offset u128 so that we don't have to take the address of the non-aligned
u128 and pass it to set_bit128.

For the 256byte_hash, fix it up so that it's actually testing the 256B
hash inside a 32-bit offset u128 as well.

Suggested-by: Ben Pfaff <blp at ovn.org>
Signed-off-by: Joe Stringer <joe at ovn.org>
Acked-by: Ben Pfaff <blp at ovn.org>




More information about the git mailing list