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
We previously created a workaround for an issue where dest_ptr is not a relocatable in #371. This PR works around the issue, but doesn’t understand or fix it.
I spent some more time looking at this recently and wanted to summarize my findings. I was not able to reproduce the issue with a standalone cairo0 program. It seems the compiler is good about preventing pointers-to-structs from being cast as integers in the way we see in the original issue.
The issue seems to happen when we add 1 to the pointer, that is (from segment_arena.cairo):
let dest_ptr = infos[0].end + 1; ⇒ dest_ptr is Int(0)
let end_ptr = infos[0].end; let dest_ptr = end_ptr + 1;
⇒ end_ptr is a proper relocatable, dest_ptr is Int(0)
While experimenting with cairo0 code, I found that a ptr to a struct gets a special Python treatment; specifically, it is represented as an instance of starkware.cairo.lang.vm.vm_consts.VmConstsReference. This may impact the way hints are executed (for example, it may have special treatment for the + operator).
There are no relocation rules present at the time this code is executed.
Given the above, I think there is something unexpected happening during the addition.
The text was updated successfully, but these errors were encountered:
We previously created a workaround for an issue where
dest_ptr
is not a relocatable in #371. This PR works around the issue, but doesn’t understand or fix it.I spent some more time looking at this recently and wanted to summarize my findings. I was not able to reproduce the issue with a standalone cairo0 program. It seems the compiler is good about preventing pointers-to-structs from being cast as integers in the way we see in the original issue.
The issue seems to happen when we add 1 to the pointer, that is (from segment_arena.cairo):
let dest_ptr = infos[0].end + 1;
⇒ dest_ptr is Int(0)let end_ptr = infos[0].end;
let dest_ptr = end_ptr + 1;
⇒ end_ptr is a proper relocatable, dest_ptr is Int(0)
starkware.cairo.lang.vm.vm_consts.VmConstsReference
. This may impact the way hints are executed (for example, it may have special treatment for the + operator).Given the above, I think there is something unexpected happening during the addition.
The text was updated successfully, but these errors were encountered: