File 0799-stdlib-Fix-bugs-in-eval_bits.patch of Package erlang
From 17712ed482b8988a783976f7738befc637bf6fc1 Mon Sep 17 00:00:00 2001
From: Hans Bolinder <hasse@erlang.org>
Date: Mon, 23 Mar 2020 11:53:49 +0100
Subject: [PATCH] stdlib: Fix bugs in eval_bits
---
lib/stdlib/src/eval_bits.erl | 6 ++++++
lib/stdlib/test/erl_eval_SUITE.erl | 12 ++++++------
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/lib/stdlib/src/eval_bits.erl b/lib/stdlib/src/eval_bits.erl
index 01b83fb918..5c75320de0 100644
--- a/lib/stdlib/src/eval_bits.erl
+++ b/lib/stdlib/src/eval_bits.erl
@@ -338,12 +338,18 @@ get_value(Bin, utf16, undefined, _Unit, _Sign, big) ->
get_value(Bin, utf16, undefined, _Unit, _Sign, little) ->
<<I/little-utf16,Rest/bits>> = Bin,
{I,Rest};
+get_value(Bin, utf16, undefined, _Unit, _Sign, native) ->
+ <<I/native-utf16,Rest/bits>> = Bin,
+ {I,Rest};
get_value(Bin, utf32, undefined, _Unit, _Sign, big) ->
<<Val/big-utf32,Rest/bits>> = Bin,
{Val,Rest};
get_value(Bin, utf32, undefined, _Unit, _Sign, little) ->
<<Val/little-utf32,Rest/bits>> = Bin,
{Val,Rest};
+get_value(Bin, utf32, undefined, _Unit, _Sign, native) ->
+ <<Val/native-utf32,Rest/bits>> = Bin,
+ {Val,Rest};
get_value(Bin, binary, all, Unit, _Sign, _Endian) ->
0 = (bit_size(Bin) rem Unit),
{Bin,<<>>};
diff --git a/lib/stdlib/test/erl_eval_SUITE.erl b/lib/stdlib/test/erl_eval_SUITE.erl
index 77e56b0712..a29b60cd1d 100644
--- a/lib/stdlib/test/erl_eval_SUITE.erl
+++ b/lib/stdlib/test/erl_eval_SUITE.erl
@@ -1729,12 +1729,12 @@ otp_14708(Config) when is_list(Config) ->
ok.
otp_16545(Config) when is_list(Config) ->
- check(fun() -> <<$W/utf16-native>> end,
- "<<$W/utf16-native>>.",
- <<0,$W>>),
- check(fun() -> <<$W/utf32-native>> end,
- "<<$W/utf32-native>>.",
- <<$W,0,0,0>>),
+ case eval_string("<<$W/utf16-native>> = <<$W/utf16-native>>.") of
+ <<$W/utf16-native>> -> ok
+ end,
+ case eval_string("<<$W/utf32-native>> = <<$W/utf32-native>>.") of
+ <<$W/utf32-native>> -> ok
+ end,
check(fun() -> <<10/unsigned,"fgbz":86>> end,
"<<10/unsigned,\"fgbz\":86>>.",
<<10,0,0,0,0,0,0,0,0,0,1,152,0,0,0,0,0,0,0,0,0,6,112,0,0,
--
2.16.4