diff options
author | Magnus Lång <[email protected]> | 2015-12-01 15:24:25 +0000 |
---|---|---|
committer | Magnus Lång <[email protected]> | 2015-12-02 15:58:15 +0100 |
commit | 34380bad4985bc827866129597e0bea940e076f4 (patch) | |
tree | 24374b86fc83e9e667df7697e76a5cf3ccc8b728 /erts | |
parent | 33299ece737c635910e358d7e09dd8af6bce1a5d (diff) | |
download | otp-34380bad4985bc827866129597e0bea940e076f4.tar.gz otp-34380bad4985bc827866129597e0bea940e076f4.tar.bz2 otp-34380bad4985bc827866129597e0bea940e076f4.zip |
hipe: Fix signed compares of unsigned sizes
Also, some of the branches were testing sizes in bits against a constant
?MAX_BINSIZE, which was in bytes. The signed comparisons masked this
mistake. These branches have been removed since all sizes in bits that
fit in a machine word are valid binary sizes.
Finally, a test that reproduces the issue was added to bs_construct,
along with a test for one of the cases (bs_init<0>(...)) when the test
against ?MAX_BINSIZE must be changed to unsigned rather than removed.
Diffstat (limited to 'erts')
-rw-r--r-- | erts/emulator/test/bs_construct_SUITE.erl | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/erts/emulator/test/bs_construct_SUITE.erl b/erts/emulator/test/bs_construct_SUITE.erl index f2bd6c233a..7ed99f5b4e 100644 --- a/erts/emulator/test/bs_construct_SUITE.erl +++ b/erts/emulator/test/bs_construct_SUITE.erl @@ -925,8 +925,8 @@ append_unit_8(Bin) -> append_unit_16(Bin) -> <<Bin/binary-unit:16,0:1>>. -%% Produce a large result of bs_add that would fit a smallnum if it was viewed -%% as signed. +%% Produce a large result of bs_add that, if cast to signed int, would overflow +%% into a negative number that fits a smallnum. bs_add_overflow(Config) -> case erlang:system_info(wordsize) of 8 -> |