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
When initializing an alias or reference to variable, we only check for the inner type, but not if the actual indirection-level matches the declaration.
FUNCTION main
VAR
s1:REF_TOLINT;
s2 AT s1 :LINT;
s3 :REFERENCETOLINTREF= s1;
END_VAREND_FUNCTION
Here, s2 and s3 should be REF_TO LINT but are declared as LINT. This leads to incorrect IR:
error[E071]: /tmp/.tmptgv8eP/target/demo.st.ll:12:9: error: stored value and pointer type do not match
store i64** %s1, i64** %s2, align 8
While it seems like LLVM fixes this when compiling to an executable (no segfaults when assigning values, printf prints the expected values), we should still add a validation to check if the pointer-depth matches the declaration.
The text was updated successfully, but these errors were encountered:
When initializing an alias or reference to variable, we only check for the inner type, but not if the actual indirection-level matches the declaration.
Here,
s2
ands3
should beREF_TO LINT
but are declared asLINT
. This leads to incorrect IR:While it seems like LLVM fixes this when compiling to an executable (no segfaults when assigning values,
printf
prints the expected values), we should still add a validation to check if the pointer-depth matches the declaration.The text was updated successfully, but these errors were encountered: