From 7dae40dd0d595776eec7c0407a7849962650e762 Mon Sep 17 00:00:00 2001 From: Kostis Sagonas Date: Sun, 12 Jan 2014 20:10:49 +0100 Subject: Add tests for the HiPE compiler (Part 1: binaries and bitstrings) Create tests for the HiPE native code compiler. This is the first part of the effort and contains tests that check that the native code produced by the HiPE compiler for binaries and bitstrings is OK and behaves similarly to the code produced by the BEAM compiler. --- lib/hipe/test/bs_SUITE_data/bs_bugs_R09.erl | 35 +++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 lib/hipe/test/bs_SUITE_data/bs_bugs_R09.erl (limited to 'lib/hipe/test/bs_SUITE_data/bs_bugs_R09.erl') diff --git a/lib/hipe/test/bs_SUITE_data/bs_bugs_R09.erl b/lib/hipe/test/bs_SUITE_data/bs_bugs_R09.erl new file mode 100644 index 0000000000..670f2a08bb --- /dev/null +++ b/lib/hipe/test/bs_SUITE_data/bs_bugs_R09.erl @@ -0,0 +1,35 @@ +%% -*- erlang-indent-level: 2 -*- +%%-------------------------------------------------------------------- +%% Date: Mon, 7 Jun 2004 13:07:39 +0300 +%% From: Einar Karttunen +%% To: Erlang ML +%% Subject: Apparent binary matching bug with native compilation +%% +%% It seems that there is a problem with binary matching when +%% compiling native code. A length prefixed field matches one +%% byte too short in the native case. +%% +%% The test module works when compiled with no options, but +%% crashes with case_clause when compiled with [native]. +%% This has been confirmed with R9C-0 and hipe snapshot 5/4/2004. +%%-------------------------------------------------------------------- + +-module(bs_bugs_R09). + +-export([test/0]). + +test() -> + ["rei",".",[]] = pp(<<3,$r,$e,$i,0>>), + ok. + +pp(Bin) -> + %% io:format("PP with ~p~n", [Bin]), + case Bin of + <<>> -> + ["."]; + <<_:2, Len:6, Part:Len/binary>> -> + [binary_to_list(Part)]; + <<_:2, Len:6, Part:Len/binary, Rest/binary>> -> + %% io:format("Len ~p Part ~p Rest ~p~n", [Len,Part,Rest]), + [binary_to_list(Part), "." | pp(Rest)] + end. -- cgit v1.2.3