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
While working on an example program, I found a compilation error which I felt troubling. Here is a minimal example :
export fn test() -> reg u32 {
reg u32 i,j,result;
result = 0;
i=3;
j=4;
while (i <(j+1)){
result += 1;
}
return result;
}
This code is wrong because you cannot increment j in the while condition. The problem is in the error report :
line -1 (-1):
compilation error in function test:
asmgen: invalid rexpr for oprd (RDX +32u ((32u) 1))
invalid rexpr for word
The location of the bug is not displayed correctly, making debugging hard. For whatever reason, the same code with a if statement return the correct location, so the bug is really bounded to while conditions.
This kind of error could potentially be captured before typing (if we consider that arithmetical expressions are not allowed in conditional).
The text was updated successfully, but these errors were encountered:
Issue
While working on an example program, I found a compilation error which I felt troubling. Here is a minimal example :
This code is wrong because you cannot increment j in the while condition. The problem is in the error report :
The location of the bug is not displayed correctly, making debugging hard. For whatever reason, the same code with a if statement return the correct location, so the bug is really bounded to while conditions.
This kind of error could potentially be captured before typing (if we consider that arithmetical expressions are not allowed in conditional).
The text was updated successfully, but these errors were encountered: