diff options
author | Sverker Eriksson <[email protected]> | 2016-11-10 20:09:48 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2016-11-17 17:18:10 +0100 |
commit | 011242f927259aa477ebe488a3ee3c4e22081488 (patch) | |
tree | 2388337f2f326680bf9cb51dcdfc97397c0328f8 /erts/emulator/beam/utils.c | |
parent | 27e865d01ad49664897662ccc123d825505c0ff6 (diff) | |
download | otp-011242f927259aa477ebe488a3ee3c4e22081488.tar.gz otp-011242f927259aa477ebe488a3ee3c4e22081488.tar.bz2 otp-011242f927259aa477ebe488a3ee3c4e22081488.zip |
erts: Tweak PSTACK to avoid warning
warning: array subscript is below array bounds
and ok, it's technically undef behavior to set pointer
before first array element.
Diffstat (limited to 'erts/emulator/beam/utils.c')
-rw-r--r-- | erts/emulator/beam/utils.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/erts/emulator/beam/utils.c b/erts/emulator/beam/utils.c index cd7131f5df..80c116fdac 100644 --- a/erts/emulator/beam/utils.c +++ b/erts/emulator/beam/utils.c @@ -204,9 +204,8 @@ erl_grow_wstack(ErtsWStack* s, Uint need) void erl_grow_pstack(ErtsPStack* s, void* default_pstack, unsigned need_bytes) { - Uint old_size = s->pend - s->pstart; + Uint old_size = s->size; Uint new_size; - Uint sp_offs = s->psp - s->pstart; if (need_bytes < old_size) new_size = 2 * old_size; @@ -220,8 +219,7 @@ erl_grow_pstack(ErtsPStack* s, void* default_pstack, unsigned need_bytes) sys_memcpy(new_ptr, s->pstart, old_size); s->pstart = new_ptr; } - s->pend = s->pstart + new_size; - s->psp = s->pstart + sp_offs; + s->size = new_size; } /* |