diff options
author | Carlos MartÃn Nieto <cmn@dwim.me> | 2014-07-25 08:25:41 +0200 |
---|---|---|
committer | Vicent Marti <tanoku@gmail.com> | 2014-08-05 02:09:37 +0200 |
commit | b4d00c1d2466de3558a7cc6983dce4eb2ee98431 (patch) | |
tree | aae2339a0570b56bdb58f9bbe721bcb8baff6698 /src | |
parent | f3f9dc075ec27935185d7f576515782416ae3cb6 (diff) | |
download | libgit2-replace-luagit2.tar.gz |
array: mark the array to grow as volatilereplace-luagit2
This works around strict aliasing rules letting some versions of
GCC (particularly on RHEL 6) thinking that they can skip updating the
size of the array when calculating the next element's offset.
Diffstat (limited to 'src')
-rw-r--r-- | src/array.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/array.h b/src/array.h index f8a48722..af9eafa4 100644 --- a/src/array.h +++ b/src/array.h @@ -44,7 +44,7 @@ typedef git_array_t(char) git_array_generic_t; /* use a generic array for growth so this can return the new item */ GIT_INLINE(void *) git_array_grow(void *_a, size_t item_size) { - git_array_generic_t *a = _a; + volatile git_array_generic_t *a = _a; uint32_t new_size = (a->size < 8) ? 8 : a->asize * 3 / 2; char *new_array = git__realloc(a->ptr, new_size * item_size); if (!new_array) { |