emil-e/rapidcheck

'Bus error' when test doesn't pass

yurivict opened this issue · 1 comments

I replaced the example:

              std::reverse(begin(l1), end(l1));
              std::reverse(begin(l1), end(l1));
              RC_ASSERT(l0 == l1);

with

              std::reverse(begin(l1), end(l1));
              std::reverse(begin(l1), end(l1));
              if (l1.size() >= 2)
                l1[1] = 2;
              RC_ASSERT(l0 == l1);

After this running it many times looks like this:

$ ./a.out ; ./a.out ; ./a.out ; ./a.out ; ./a.out ; ./a.out ; ./a.out ; ./a.out ; ./a.out ; ./a.out ; ./a.out ; ./a.out ; ./a.out ; ./a.out 
Using configuration: seed=3420795165117013011

- double reversal yields the original value
Bus error
Using configuration: seed=14684516960598901972

- double reversal yields the original value
Bus error
Using configuration: seed=15202572642935427351

- double reversal yields the original value
Bus error
Using configuration: seed=17945400595239408832

- double reversal yields the original value
Bus error
Using configuration: seed=6165691666768869258

- double reversal yields the original value
Bus error
Using configuration: seed=10672790074681973720

- double reversal yields the original value
Bus error
Using configuration: seed=2121517870367621541

- double reversal yields the original value
Bus error7bc7d30
Using configuration: seed=7785047867429658057

- double reversal yields the original value
Bus error
Using configuration: seed=6591167973284169841

- double reversal yields the original value
Bus error
Using configuration: seed=18126788677756282608

- double reversal yields the original value
Bus error
Using configuration: seed=13259295632729924319

- double reversal yields the original value
Bus error
Using configuration: seed=694945028765923653

- double reversal yields the original value
Bus error
Using configuration: seed=8444319495471288925

- double reversal yields the original value
Bus error
Using configuration: seed=17043435700674168975

- double reversal yields the original value
Bus error

Please also note that it probably didn't try the cases of array sizes 0 and 1, because every try crashed, even though sizes 0 and 1 should pass.

Rev. 7bc7d30
OS: FreeBSD 12.2

This is what is expected if you are trying to modify eg a const vector or a string literal.

Are you modifying the example in the readme? That one is using a const vector.