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

Return compile error (llvm) for setting immutable global #674

Merged
merged 1 commit into from
Aug 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/llvm-backend/src/code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1151,7 +1151,9 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
builder.build_store(ptr_to_value, value);
}
GlobalCache::Const { value: _ } => {
unreachable!("cannot set non-mutable globals")
return Err(CodegenError {
message: "global is immutable".to_string(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be nice to include more information here if it's available, like what global and what value maybe. To make debugging easier

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like having more context, I'll start thinking about this as I see more messages.

});
}
}
}
Expand Down
1 change: 0 additions & 1 deletion lib/spectests/tests/excludes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,6 @@ llvm:skip:skip-stack-guard-page.wast:* # Spec running forever or (signal: 4, SIG
llvm:skip:linking.wast:236 # terminating with uncaught exception of type WasmTrap
llvm:skip:linking.wast:248 # terminating with uncaught exception of type WasmTrap

llvm:fail:globals.wast:243 # AssertInvalid - caught panic Any
llvm:fail:i32.wast:243 # AssertReturn - result I32(61374799) ("0x3a8814f") does not match expected I32(32) ("0x20")
llvm:fail:i32.wast:252 # AssertReturn - result I32(61374816) ("0x3a88160") does not match expected I32(32) ("0x20")
llvm:fail:i64.wast:243 # AssertReturn - result I64(4356342255) ("0x103a881ef") does not match expected I64(64) ("0x40")
Expand Down