Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange issues with bit operations #1962

Closed
schmee opened this issue Feb 14, 2019 · 1 comment
Closed

Strange issues with bit operations #1962

schmee opened this issue Feb 14, 2019 · 1 comment
Milestone

Comments

@schmee
Copy link
Sponsor Contributor

schmee commented Feb 14, 2019

I've run in to a strange issue in a project I've been working on. Basically, this line causes a change of behavior in --release-safe and --release-fast modes. Here's what it looks like running the tests:

With the line uncommented, the tests pass in debug, release-safe and release-fast:

➜  test git:(master) zig test des_test.zig
Test 1/7 test vectors ECB encrypt...OK
Test 2/7 test vectors ECB decrypt...OK
Test 3/7 encrypt random data with ECB...OK
Test 4/7 decrypt random data with ECB...OK
Test 5/7 3DES ECB crypt...OK
Test 6/7 DES CBC crypt...OK
Test 7/7 3DES CBC crypt...OK
All tests passed.

With the line commented, the follow happens:

  • debug - tests pass
➜  test git:(master) ✗ zig test des_test.zig
Test 1/7 test vectors ECB encrypt...OK
Test 2/7 test vectors ECB decrypt...OK
Test 3/7 encrypt random data with ECB...OK
Test 4/7 decrypt random data with ECB...OK
Test 5/7 3DES ECB crypt...OK
Test 6/7 DES CBC crypt...OK
Test 7/7 3DES CBC crypt...OK
All tests passed.
  • --release-safe - tests fail because they produce incorrect output, but no crash:
➜  test git:(master) ✗ zig test --release-safe des_test.zig
Test 1/7 test vectors ECB encrypt...expected 10137153925907983143, found 10784105874870413645

Tests failed. Use the following command to reproduce the failure:
/Users/john.schmidt/personal_programming/zig/des/test/zig-cache/test
  • --release-fast - the compiler hangs
➜  test git:(master) ✗ zig test --release-fast des_test.zig
(nothing happens)

All of these issues might be a symptom of #1932, but since I'm not sure I thought I'd open a separate issue to track it somewhere.

Versions:

➜  des git:(master) zig version
0.3.0+c58b8020

macOS Mojave 10.14.3

@andrewrk andrewrk added this to the 0.5.0 milestone Feb 15, 2019
@andrewrk andrewrk modified the milestones: 0.5.0, 0.6.0 Sep 26, 2019
@schmee
Copy link
Sponsor Contributor Author

schmee commented Dec 24, 2019

Closing this in favor of #3980 since it's the same issue with a better repro.

@schmee schmee closed this as completed Dec 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants