Skip to content

Commit

Permalink
This is a strict aliasing issue, right?
Browse files Browse the repository at this point in the history
  • Loading branch information
XrXr committed Feb 19, 2021
1 parent 4b4d91c commit 5996255
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion darray.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ rb_darray_make_impl(void *ptr_to_ary, int32_t array_size, size_t header_size, si
meta->size = array_size;
meta->capa = array_size;

*ptr_to_ptr_to_meta = meta;
// Write out result with memcpy to avoid strict aliasing issue.
memcpy(ptr_to_ptr_to_meta, &meta, sizeof(meta));
return 1;
}

Expand Down

0 comments on commit 5996255

Please sign in to comment.