Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Same IR Code, But Verification Fail #1087

Open
IamYJLee opened this issue Sep 11, 2024 · 4 comments
Open

Same IR Code, But Verification Fail #1087

IamYJLee opened this issue Sep 11, 2024 · 4 comments
Labels
memory Memory Model

Comments

@IamYJLee
Copy link
Contributor

I found something I don't understand while looking into the case of ERROR: Source and target don't have the same return domain.
Why did the verification fail?

https://alive2.llvm.org/ce/z/SBacDP

@nunoplopes nunoplopes added the memory Memory Model label Sep 11, 2024
@nunoplopes
Copy link
Member

reduced test case:

declare void @use_writeonly(ptr) memory(write)

define void @src() {
  %src = alloca i32, align 4
  %dest = alloca i32, align 4
  call void @use_writeonly(ptr %dest)
  ret void
}

define void @tgt() {
  %src = alloca i32, align 4
  %dest = alloca i32, align 4
  call void @use_writeonly(ptr %dest)
  ret void
}

@IamYJLee
Copy link
Contributor Author

I would like to try to fix this problem. Could I get some help to do so?

@nunoplopes
Copy link
Member

It's hard to give any concrete advise. The bug can be either in state,cpp (addFnCall), in memory.cpp (refinement of input memory for the function), or in pointer.cpp (refinement of input ptrs to the function).

@IamYJLee
Copy link
Contributor Author

Thank you for advise.
I am trying to fix this problem.
I saw a difference between the source and target in the function domain.

Source :

domain = (or (and |@use_writeonly#ptr!void#ub!7| |@use_writeonly#ptr!void#noreturn!8|)
    (and |@use_writeonly#ptr!void#ub!7|
         (not |@use_writeonly#ptr!void#noreturn!8|)))

Target:

domain = (or (and |@use_writeonly#ptr!void#ub!7|
         (ite (= #b1 ((_ extract 1 1) (blk_kind #b1)))
              (and (= #b01 (blk_kind #b1)) (= #x4 (blk_size #b1)))
              (bvule (blk_size #b1) #x4))
         |@use_writeonly#ptr!void#noreturn!8|)
    (and |@use_writeonly#ptr!void#ub!7|
         (not |@use_writeonly#ptr!void#noreturn!8|)
         (ite (= #b1 ((_ extract 1 1) (blk_kind #b1)))
              (and (= #b01 (blk_kind #b1)) (= #x4 (blk_size #b1)))
              (bvule (blk_size #b1) #x4))))

And if the memory function attribute is removed, this problem does not occur.
So I am debugging the State::addFnCall function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
memory Memory Model
Projects
None yet
Development

No branches or pull requests

2 participants