0x0687
1
Hi,
Is anyone else getting segmentation faults when building sui code that contains match statements on an enum?
Here is an example
/// Module: enum_segmentation_fault_demo
module enum_segmentation_fault_demo::enum_segmentation_fault_demo;
public enum Action has copy, drop {
X,
Y,
Z
}
// $sui move --version => Version sui-move 1.38.3-homebrew
// sui move build => Segmentation fault (core dumped)
public fun demo(action: Action){
match(action){
Action::X => (),
Action::Y => (),
_ => ()
}
}
I’m using ubuntu 24 and my sui version is sui-move 1.38.3-homebrew.
Kind regards,
06 87
0x0687
2
Further investigation with Todd on discord allowed us to find the following stacktrace
(gdb) run
Starting program: /home/linuxbrew/.linuxbrew/bin/sui move build
Downloading separate debug info for system-supplied DSO at 0x7ffff7fc3000
warning: File "/home/linuxbrew/.linuxbrew/Cellar/gcc/14.2.0_1/lib/gcc/current/libstdc++.so.6.0.33-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
To enable execution of this file add
add-auto-load-safe-path /home/linuxbrew/.linuxbrew/Cellar/gcc/14.2.0_1/lib/gcc/current/libstdc++.so.6.0.33-gdb.py
line to your configuration file "/home/x/.config/gdb/gdbinit".
To completely disable this security protection add
set auto-load safe-path /
line to your configuration file "/home/x/.config/gdb/gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual. E.g., run from the shell:
info "(gdb)Auto-loading safe path"
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff76006c0 (LWP 25272)]
[New Thread 0x7ffff72006c0 (LWP 25273)]
[New Thread 0x7ffff6e006c0 (LWP 25275)]
[New Thread 0x7ffff6a006c0 (LWP 25276)]
[New Thread 0x7ffff66006c0 (LWP 25277)]
[New Thread 0x7ffff62006c0 (LWP 25278)]
[New Thread 0x7ffff5e006c0 (LWP 25279)]
[New Thread 0x7ffff5a006c0 (LWP 25280)]
[New Thread 0x7ffff56006c0 (LWP 25282)]
[New Thread 0x7ffff52006c0 (LWP 25283)]
[New Thread 0x7ffff4e006c0 (LWP 25284)]
[New Thread 0x7ffff4a006c0 (LWP 25285)]
[New Thread 0x7ffff46006c0 (LWP 25286)]
[New Thread 0x7fffefe006c0 (LWP 25287)]
[New Thread 0x7fffefa006c0 (LWP 25288)]
[New Thread 0x7fffef6006c0 (LWP 25289)]
[New Thread 0x7fffeee006c0 (LWP 25290)]
[Detaching after vfork from child process 25291]
[Detaching after vfork from child process 25293]
[Detaching after vfork from child process 25294]
UPDATING GIT DEPENDENCY https://github.com/MystenLabs/sui.git
[Detaching after vfork from child process 25298]
remote: Enumerating objects: 1524, done.
remote: Counting objects: 100% (983/983), done.
remote: Total 1524 (delta 983), reused 983 (delta 983), pack-reused 541 (from 1)
Receiving objects: 100% (1524/1524), 3.48 MiB | 7.75 MiB/s, done.
Resolving deltas: 100% (1103/1103), completed with 225 local objects.
From https://github.com/MystenLabs/sui
+ 717f6f00e6...4e142186e8 gh-pages -> origin/gh-pages (forced update)
* [new tag] sui_v1.39.0_1733427511_ci -> sui_v1.39.0_1733427511_ci
[Detaching after vfork from child process 26006]
INCLUDING DEPENDENCY Sui
INCLUDING DEPENDENCY MoveStdlib
BUILDING enum_segmentation_fault_demo
[New Thread 0x7fffeea006c0 (LWP 26022)]
[New Thread 0x7fffee6006c0 (LWP 26023)]
[New Thread 0x7fffee2006c0 (LWP 26024)]
[New Thread 0x7fffede006c0 (LWP 26025)]
[New Thread 0x7fffeda006c0 (LWP 26026)]
[New Thread 0x7fffed6006c0 (LWP 26027)]
[New Thread 0x7fffed2006c0 (LWP 26028)]
[New Thread 0x7fffece006c0 (LWP 26029)]
[New Thread 0x7fffeca006c0 (LWP 26031)]
[New Thread 0x7fffec6006c0 (LWP 26032)]
[New Thread 0x7fffe3e006c0 (LWP 26034)]
[New Thread 0x7fffe3a006c0 (LWP 26035)]
[New Thread 0x7fffe36006c0 (LWP 26036)]
[New Thread 0x7fffe32006c0 (LWP 26037)]
[New Thread 0x7fffe2e006c0 (LWP 26038)]
[New Thread 0x7fffe2a006c0 (LWP 26039)]
Thread 1 "sui" received signal SIGSEGV, Segmentation fault.
0x000055555bca4ecc in move_compiler::naming::translate::match_pattern ()
(gdb) bt
#0 0x000055555bca4ecc in move_compiler::naming::translate::match_pattern ()
#1 0x000055555bc9f0ee in move_compiler::naming::translate::match_arm ()
#2 0x000055555c17ab38 in alloc::vec::in_place_collect::from_iter_in_place ()
#3 0x000055555bce8a76 in move_compiler::naming::translate::exp ()
#4 0x000055555bce7227 in move_compiler::naming::translate::sequence_item ()
#5 0x000055555bdab662 in <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold ()
#6 0x000055555bce6d4c in move_compiler::naming::translate::sequence ()
#7 0x000055555bc4b835 in core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once ()
#8 0x000055555c02a2df in <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter ()
#9 0x000055555c0bb7c1 in <alloc::collections::btree::map::BTreeMap<K,V> as core::iter::traits::collect::FromIterator<(K,V)>>::from_iter ()
#10 0x000055555bc47d4d in core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once ()
#11 0x000055555c049b9c in <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter ()
#12 0x000055555c0b6abe in <alloc::collections::btree::map::BTreeMap<K,V> as core::iter::traits::collect::FromIterator<(K,V)>>::from_iter ()
#13 0x000055555bc95af4 in move_compiler::naming::translate::program ()
#14 0x000055555bb5e61e in move_compiler::command_line::compiler::run::rec ()
#15 0x000055555bb5e721 in move_compiler::command_line::compiler::run::rec ()
#16 0x000055555bb5d8b6 in move_compiler::command_line::compiler::SteppedCompiler<_>::run ()
#17 0x000055555bb1e79d in move_compiler::command_line::compiler::Compiler::run ()
#18 0x000055555bb1f091 in move_compiler::command_line::compiler::Compiler::build ()
#19 0x000055555a4d505a in move_package::compilation::compiled_package::CompiledPackage::build_all ()
#20 0x000055555a4f8b08 in move_package::compilation::build_plan::BuildPlan::compile_with_driver_and_deps ()
#21 0x000055555a4de8cc in sui_move_build::build_from_resolution_graph ()
#22 0x000055555a4ddbed in sui_move_build::BuildConfig::build ()
#23 0x000055555a3471c7 in sui_move::build::Build::execute_internal ()
#24 0x000055555a34710a in sui_move::build::Build::execute ()
#25 0x000055555a329a22 in sui_move::execute_move_command ()
#26 0x00005555562a8148 in sui::sui_commands::SuiCommand::execute::{{closure}} ()
#27 0x00005555563349d6 in tokio::runtime::park::CachedParkThread::block_on ()
#28 0x0000555555e0ce2a in tokio::runtime::context::runtime::enter_runtime ()
#29 0x0000555556343e13 in tokio::runtime::runtime::Runtime::block_on ()
#30 0x0000555555f59c71 in sui::main ()
#31 0x0000555555db6a33 in std::sys::backtrace::__rust_begin_short_backtrace ()
#32 0x0000555556295969 in std::rt::lang_start::{{closure}} ()
#33 0x000055555c7fe390 in std::rt::lang_start_internal ()
#34 0x0000555555f59d6c in main ()
Note that this is a build on Ubuntu 24.04 with homebrew.
I will now continue using the build from source which is working without any problems.
1 Like