You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looks like the pop macro has problems. The source of the problem is taking the value from the stack using it's native pointer type and saving it in a local, then casting the local value to the requested type. This does not correspond to the push, where the stack pointer is cast and we copy it in using a pointer to the requested type.
Changing the pop to cast the pointer and take the value using a pointer to the requested type, then returning that clears up all the test case failures.
The text was updated successfully, but these errors were encountered:
Explanation: Enums are 4 bytes, meanwhile the pointers 8. During push, we write the following significant bytes of the enum to memory (a3 is highest significance, written to the lowest address, and so on).
a3 a2 a1 a0
During reading we read back:
b7 b6 b5 b4 b3 b2 b1 b0
Then when we cast it we reduce it to
b3 b2 b1 b0
The original bytes are lost. We are actually reading back random data.
Believe this to be the cause of adrian-thurston/ragel#61.
Approximately 107 / 170 test cases fail. One segfault. Looking at forloop1, as an example:
With input
a b c
this prints three empty lines. Removing the tree trim this succeeds as expected.While stepping through the print I noticed that pushing non-pointer types seems to be broken. Pushing:
Comes back as
0
when the corresponding pop is issued.Looks like the pop macro has problems. The source of the problem is taking the value from the stack using it's native pointer type and saving it in a local, then casting the local value to the requested type. This does not correspond to the push, where the stack pointer is cast and we copy it in using a pointer to the requested type.
Changing the pop to cast the pointer and take the value using a pointer to the requested type, then returning that clears up all the test case failures.
The text was updated successfully, but these errors were encountered: