-
Notifications
You must be signed in to change notification settings - Fork 46
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
Semantic errors in infer_ops.rs #123
Comments
To clarify, infer_ops output is compared against the Python, however very little of the logic in infer_ops is checked by the runnable/printed code, so the results can be different for each language, and the test rig wont notice. The fix for this issue needs to be expanded logic in infer_ops.py to verify all of the logic within it. |
Rules C uses for integer conversions: https://wiki.sei.cmu.edu/confluence/display/c/INT02-C.+Understand+integer+conversion+rules |
This is further complicated by the fact that Rust and C use different rules for integer conversions:
|
One possibility is to generate code in the other 5 languages to have semantics similar to C. Widen to int, perform the operation and then truncate. But the choice of "int" in the C standard seems arbitrary. We could widen to the next integer type with a greater rank that prevents overflow or underflow. For this case:
I was completely unaware of the "integer rank" concept in the C language. Glad that the concept matches what I came up with for py2many (RUST_WIDTH_RANK) |
Tested to work only for widening ops. Need similar code for subtraction and negative numbers etc. Once we have it working we should write similar code for other languages that need it. The following cases pass on rust: ``` assert add1(127 - 1, 1) == 127 assert add2(32767, 1) == 32768 assert add3(2147483647, 1) == 2147483648 ``` Related to: #123
Tested to work only for widening ops. Need similar code for subtraction and negative numbers etc. Once we have it working we should write similar code for other languages that need it. The following cases pass on rust: ``` assert add1(127 - 1, 1) == 127 assert add2(32767, 1) == 32768 assert add3(2147483647, 1) == 2147483648 ``` Related to: #123
Tested to work only for widening ops. Need similar code for subtraction and negative numbers etc. Once we have it working we should write similar code for other languages that need it. The following cases pass on rust: ``` assert add1(127 - 1, 1) == 127 assert add2(32767, 1) == 32768 assert add3(2147483647, 1) == 2147483648 ``` Related to: #123
Tested to work only for widening ops. Need similar code for subtraction and negative numbers etc. Once we have it working we should write similar code for other languages that need it. The following cases pass on rust: ``` assert add1(127, 1) == 128 assert add2(32767, 1) == 32768 assert add3(2147483647, 1) == 2147483648 ``` Related to: #123
Tested to work only for widening ops. Need similar code for subtraction and negative numbers etc. Once we have it working we should write similar code for other languages that need it. The following cases pass on rust: ``` assert add1(127, 1) == 128 assert add2(32767, 1) == 32768 assert add3(2147483647, 1) == 2147483648 ``` Related to: py2many#123
Description in
8b90aba
The text was updated successfully, but these errors were encountered: