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

[Bug][move-compiler-v2] V2 wrongly gives "cannot drop value which is still borrowed" #14646

Open
zzjas opened this issue Sep 15, 2024 · 1 comment

Comments

@zzjas
Copy link

zzjas commented Sep 15, 2024

🐛 Bug

module 0xCAFE::Module0 {
    public fun f() {
            *(
                if (true) {
                    if (true) {
                        if (true) { &(0) }
                        else {
                            if (true) { &(0) }
                            else { &(0) }
                        }
                    } else { &(0) }
                } else {
                    if (true) {
                        if (true) {
                            if (true) { &(0) }
                            else { &(0) }
                        } else {
                            if (true) { &(0) }
                            else { &(0) }
                        }
                    } else {
                        if (true) {
                            if (true) { &(0) }
                            else { &(0) }
                        } else { &(0) }
                    }
                }
            );
    }
}

V1 can compile this fine. V2 will give:

error: cannot drop value which is still borrowed
   ┌─ ~/debug_package/sources/MoveSmith.move:3:13
   │  
 3 │ ╭             *(
 4 │ │                 if (true) {
 5 │ │                     if (true) {
 6 │ │                         if (true) { &(0) }
   · │
27 │ │                 }
28 │ │             );
   │ ╰─────────────^ dropped here

Removing any individual if-else will make the error disappear, but I haven't tried removing combinations of multiple ones.

@zzjas
Copy link
Author

zzjas commented Sep 16, 2024

A similar input can cause V1 to crash #14095 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🆕 New
Development

No branches or pull requests

3 participants