diff --git a/bugs/idioms-ashr/2020-08-02/test.x64.gcc.O0.elf b/bugs/idioms-ashr/2020-08-02/test.x64.gcc.O0.elf new file mode 100755 index 00000000..aaa6a2fd Binary files /dev/null and b/bugs/idioms-ashr/2020-08-02/test.x64.gcc.O0.elf differ diff --git a/bugs/idioms-ashr/2020-08-02/test.x64.gcc.O1.elf b/bugs/idioms-ashr/2020-08-02/test.x64.gcc.O1.elf new file mode 100755 index 00000000..fcc396b6 Binary files /dev/null and b/bugs/idioms-ashr/2020-08-02/test.x64.gcc.O1.elf differ diff --git a/bugs/idioms-ashr/2020-08-02/test.x64.gcc.O2.elf b/bugs/idioms-ashr/2020-08-02/test.x64.gcc.O2.elf new file mode 100755 index 00000000..948669da Binary files /dev/null and b/bugs/idioms-ashr/2020-08-02/test.x64.gcc.O2.elf differ diff --git a/bugs/idioms-ashr/2020-08-02/test.x64.gcc.O3.elf b/bugs/idioms-ashr/2020-08-02/test.x64.gcc.O3.elf new file mode 100755 index 00000000..948669da Binary files /dev/null and b/bugs/idioms-ashr/2020-08-02/test.x64.gcc.O3.elf differ diff --git a/bugs/idioms-ashr/test.c b/bugs/idioms-ashr/test.c new file mode 100644 index 00000000..74a671e5 --- /dev/null +++ b/bugs/idioms-ashr/test.c @@ -0,0 +1,21 @@ +// +// Created from https://github.com/avast/retdec/issues/724 +// Author: adahsuzixin +// + +#include + +char getSecondByte(long long a); + +int main(void) +{ + long long a; + scanf("%llx", &a); + char res = getSecondByte(a); + printf("getSecondByte( %llx ) = %d\n",a,res); + return res; +} + +char getSecondByte(long long a) { + return (a >> 8) & 0xff; +} diff --git a/bugs/idioms-ashr/test.py b/bugs/idioms-ashr/test.py new file mode 100644 index 00000000..4c9415d9 --- /dev/null +++ b/bugs/idioms-ashr/test.py @@ -0,0 +1,19 @@ +# +# Created from https://github.com/avast/retdec/issues/724 +# Author: adahsuzixin +# + +from regression_tests import * + +class TestBase(Test): + def test_produce_expected_output(self): + self.assert_c_produces_output_when_run( + input='0xa5a5a5a5a5a50020', + expected_output='getSecondByte( a5a5a5a5a5a50020 ) = 0\n', + expected_return_code=0 + ) + +class Test_shiftOrDivide(TestBase): + shiftOrDivide = TestSettings( + input=files_in_dir('2020-08-02') + )