snu-sf-class / swpp202401

Principles and Practices of Software Development Main Repository
13 stars 4 forks source link

[Project] Interpreter error: vupdate/vextct #137

Open sbkim28 opened 4 weeks ago

sbkim28 commented 4 weeks ago

안녕하세요, interpreter에서 오류가 발생하는 것 같아 이를 제보하고자 합니다.

다음은 제가 임의로 작성한 LLVM IR 코드입니다.

define dso_local i32 @main() #0 {
entry:
  %v0 = insertelement <8 x i32> undef, i32 0, i32 7
  %v1 = extractelement <8 x i32> %v0, i32 7
  %conv = zext i32 %v1 to i64
  call void @write(i64 %conv)
  ret i32 0
}

해당 코드를 컴파일하면 다음과 같은 어셈블리 코드를 얻습니다.

start main 0:
.entry:
r2 = const 0
r1 = const 7
v1 = vupdate v1 r2 r1 32
r1 = vextct v1 r1 32
call write r1
ret r2
end main

이를 실행하면 다음과 같은 에러가 발생합니다. index out of bounds: the len is 4 but the index is 7

해당 문제를 확인해주셨으면 합니다. 감사합니다.

Hyun2023 commented 4 weeks ago

인터프리터 내부에서 벡터를 32비트 형태로 바꾸는 과정에 실수가 있었던 것 같습니다. 조만간 수정될 예정입니다.

Hyun2023 commented 3 weeks ago

6월 3일자 패치로 수정되었습니다.