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

switch to rust 1.67 #5345

Merged
merged 5 commits into from
Jul 10, 2023
Merged

switch to rust 1.67 #5345

merged 5 commits into from
Jul 10, 2023

Conversation

Anton-4
Copy link
Collaborator

@Anton-4 Anton-4 commented Apr 29, 2023

This upgrade is causing a segmentation fault when running ./crates/repl_test/test_wasm.sh.
When upgrading to 1.67 the size of Stmt and Expr also changed from:

roc_error_macros::assert_sizeof_non_wasm!(Expr, 9 * 8);
roc_error_macros::assert_sizeof_non_wasm!(Stmt, 12 * 8);

to:

roc_error_macros::assert_sizeof_non_wasm!(Expr, 10 * 8);
roc_error_macros::assert_sizeof_non_wasm!(Stmt, 13 * 8);

So that could be related to this issue.

Lots of tests out of the repl_test suite are segfaulting:

arbitrary_tag_unions 
basic_1_field_f64_record 
basic_1_field_i64_record 
basic_2_field_f64_record 
basic_2_field_i64_record 
basic_2_field_mixed_record 
basic_3_field_record 
bool_basic_equality 
bool_false 
bool_in_record 
bool_true 
byte_tag_union 
dec_in_repl 
empty_record 
enum_tag_union_in_list 
float_addition 
four_element_record 
identity_lambda 
int_addition 
issue_2149 
issue_2810_recursive_layout_inside_nonrecursive 
large_nullable_wrapped_tag_union 
large_recursive_tag_union_flat_variant 
large_recursive_tag_union_recursive_variant 
list_of_1_field_records 
list_of_2_field_records 
list_of_3_field_records 
literal_0 
literal_42
...

I assume literal_0 is the simplest failure:
valgrind output for literal_0 test

@folkertdev
Copy link
Contributor

do our gen tests also fail (e.g. cargo test-gen-llvm)?

@Anton-4
Copy link
Collaborator Author

Anton-4 commented May 1, 2023

No, all others tests pass when I skip the wasm repl tests, see 8cc36c6

@github-actions

This comment was marked as outdated.

@Anton-4 Anton-4 added blocked Prevents this PR from auto-closing after 30 days of inactivity and removed inactive for 30 days labels Jun 2, 2023
@Anton-4

This comment was marked as outdated.

@alexpyattaev

This comment was marked as off-topic.

@Anton-4

This comment was marked as off-topic.

@Anton-4

This comment was marked as off-topic.

@alexpyattaev

This comment was marked as off-topic.

@Anton-4

This comment was marked as off-topic.

@alexpyattaev

This comment was marked as off-topic.

@folkertdev

This comment was marked as off-topic.

@folkertdev

This comment was marked as off-topic.

@alexpyattaev

This comment was marked as off-topic.

@alexpyattaev

This comment was marked as off-topic.

@nektro

This comment was marked as off-topic.

@nektro

This comment was marked as off-topic.

@folkertdev

This comment was marked as off-topic.

@alexpyattaev

This comment was marked as off-topic.

@nektro

This comment was marked as off-topic.

@Anton-4
Copy link
Collaborator Author

Anton-4 commented Jun 19, 2023

The conversation got a bit of track here :p
I've hidden comments that were not directly related to this pr.

@folkertdev folkertdev force-pushed the rust-1-67 branch 2 times, most recently from 66092a9 to 152ca01 Compare June 26, 2023 18:46
@folkertdev
Copy link
Contributor

This branch works for me locally on linux with rust 1.67. The size asserts succeed, so any failing size assert (on linux) must be because some different rust version is used. @Anton-4 maybe the CI runs could print their rust/cargo version?

@Anton-4
Copy link
Collaborator Author

Anton-4 commented Jun 27, 2023

Bizarre, the CI machines get their rust version from rust-toolchain.toml so it should be correct. I'll investigate.

@folkertdev
Copy link
Contributor

folkertdev commented Jun 27, 2023

for me locally, I did a rustup override at some point, and the toolchain.toml is now ignored. maybe something similar happened? when you install rust with rustup, the cargo binary is secretly a rustup binary so it can do this sort of thing

@Anton-4
Copy link
Collaborator Author

Anton-4 commented Jun 27, 2023

It's for the default.nix file that the build failed, that's the only one not using the toolchain file, I just need to pick the right nix commmit there.

@Anton-4
Copy link
Collaborator Author

Anton-4 commented Jun 27, 2023

I'll see if I can improve the error message for this case.

@Anton-4
Copy link
Collaborator Author

Anton-4 commented Jun 27, 2023

I just need to pick the right nix commmit there.

I found a commit with the right rust version but the building takes long and crashed my computer every time I ran it, so I'm going to try some other commits.

@Anton-4
Copy link
Collaborator Author

Anton-4 commented Jun 27, 2023

The default.nix build should be fixed now, can you check out the merge conflict @folkertdev?

@folkertdev folkertdev removed the blocked Prevents this PR from auto-closing after 30 days of inactivity label Jun 27, 2023
@folkertdev folkertdev force-pushed the rust-1-67 branch 3 times, most recently from c6e253f to 22a822a Compare July 5, 2023 20:28
@folkertdev
Copy link
Contributor

@Anton-4 somehow CI is using the old version again. also, for repl tests we use a prior full build of the compiler. Are we sure that is also the 1.67 version?

@folkertdev
Copy link
Contributor

and I can actually reproduce the segfault in the repl tests. Really not sure what is happening here though

lldb /home/folkertdev/roc/roc/target/release/deps/repl_test-a4c583a2f4ab6ba8 -- basic_1_field_f64_record
(lldb) target create "/home/folkertdev/roc/roc/target/release/deps/repl_test-a4c583a2f4ab6ba8"
Current executable set to '/home/folkertdev/roc/roc/target/release/deps/repl_test-a4c583a2f4ab6ba8' (x86_64).
(lldb) settings set -- target.run-args  "basic_1_field_f64_record"
(lldb) r
Process 272133 launched: '/home/folkertdev/roc/roc/target/release/deps/repl_test-a4c583a2f4ab6ba8' (x86_64)

running 1 test
Process 272133 stopped
* thread #2, name = 'tests::basic_1_', stop reason = signal SIGSEGV: invalid address (fault address: 0x55555c16b850)
    frame #0: 0x0000555555892272 repl_test-a4c583a2f4ab6ba8`_$LT$roc_wasm_module..opcodes..OpCode$u20$as$u20$core..fmt..Debug$GT$::fmt::hca6027b3822fecf8 + 482
repl_test-a4c583a2f4ab6ba8`_$LT$roc_wasm_module..opcodes..OpCode$u20$as$u20$core..fmt..Debug$GT$::fmt::hca6027b3822fecf8:
->  0x555555892272 <+482>: add    qword ptr [rcx + 8*r13], rax
    0x555555892276 <+486>: in     al, 0x4
    0x555555892278 <+488>: add    byte ptr [rax], al
    0x55555589227a <+490>: lea    rsi, [rip + 0x30a61bd]
(lldb) bt
* thread #2, name = 'tests::basic_1_', stop reason = signal SIGSEGV: invalid address (fault address: 0x55555c16b850)
  * frame #0: 0x0000555555892272 repl_test-a4c583a2f4ab6ba8`_$LT$roc_wasm_module..opcodes..OpCode$u20$as$u20$core..fmt..Debug$GT$::fmt::hca6027b3822fecf8 + 482
(lldb) 

@folkertdev
Copy link
Contributor

ah ok we reach an unreachable pattern

* thread #2, name = 'tests::basic_1_', stop reason = signal SIGILL: illegal instruction operand
    frame #0: 0x0000555555b84007 repl_test-bc3f3018083afd01`roc_wasm_module::opcodes::immediates_for::hc716e975801f3795(op=252) at opcodes.rs:263:25
   260 	        // Catch-all in case of an invalid cast from u8 to OpCode while parsing binary
   261 	        // (rustc keeps this code, I verified in Compiler Explorer)
   262 	        #[allow(unreachable_patterns)]
-> 263 	        _ => return Err(format!("Unknown Wasm instruction 0x{:02x}", op as u8)),
   264 	    };
   265 	
   266 	    Ok(imm)

will have to investigate further

@Anton-4
Copy link
Collaborator Author

Anton-4 commented Jul 7, 2023

somehow CI is using the old version again

I believe the rebase/force push wrote over my earlier change.

also, for repl tests we use a prior full build of the compiler. Are we sure that is also the 1.67 version?

I haven't manually checked it but it is very likely to be the correct version.

@folkertdev
Copy link
Contributor

I was confused about the version because I missed that it were specifically the wasm repl tests that failed. I can reproduce the failure locally, but still need to look into why this now fails.

@folkertdev folkertdev marked this pull request as ready for review July 10, 2023 16:30
@folkertdev folkertdev changed the title WIP switch to rust 1.67 switch to rust 1.67 Jul 10, 2023
@Anton-4 Anton-4 enabled auto-merge July 10, 2023 18:47
@Anton-4 Anton-4 merged commit 8b79606 into main Jul 10, 2023
10 checks passed
@Anton-4 Anton-4 deleted the rust-1-67 branch July 10, 2023 18:47
@Anton-4
Copy link
Collaborator Author

Anton-4 commented Jul 10, 2023

🎉 🍾

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

Successfully merging this pull request may close these issues.

4 participants