Bug: yue segfaults with macros
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 613
- Forks
- 45
- PR merge metrics
- No merged PRs in 30d
Description
I tried yue on android with termux
It compiles and works decently except . When the script has macros it segfaults when while compiling to lua
Backtrace:
Thread 2 "yue" received signal SIGSEGV, Segmentation fault.
[Switching to LWP 620]
__gnu_Unwind_Resume (ucbp=0x2, entry_vrs=0xf6e59dd4)
at /buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/unwind-arm-common.inc:482
482 /buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/unwind-arm-common.inc: (undocumented errno 2).
(gdb) bt
#0 __gnu_Unwind_Resume (ucbp=0x2, entry_vrs=0xf6e59dd4)
at /buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/libgcc/unwind-arm-common.inc:482
#1 0xf734ed00 in ___Unwind_Resume ()
from /apex/com.android.runtime/lib/bionic/libc.so
#2 0xaadbc7ac in yue::YueCompilerImpl::isMacroChain(parserlib::ChainValue_t*) const ()
#3 0xaadb45c0 in yue::YueCompilerImpl::transformBlock(parserlib::Block_t*, std::__ndk1::list<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, std::__ndk1::allocator<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > > >&, yue::YueCompilerImpl::ExpUsage, parserlib::ExpList_t*, bool) ()
#4 0xaadb08ac in yue::YueCompilerImpl::compile(std::__ndk1::basic_string_view<char, std::__ndk1::char_traits<char> >, yue::YueConfig const&) ()
#5 0xaadb05a0 in yue::YueCompiler::compile(std::__ndk1::basic_string_view<char, std::__ndk1::char_traits<char> >, yue::YueConfig const&) ()
#6 0xaad9e348 in std::__ndk1::__async_func<main::$_4>::operator()() ()
#7 0xaad9df24 in std::__ndk1::__async_assoc_state<std::__ndk1::tuple<int, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > >, std::__ndk1::__async_func<main::$_4> >::__execute() ()
#8 0xaada0090 in void* std::__ndk1::__thread_proxy<std::__ndk1::tuple<std::__ndk1::unique_ptr<std::__ndk1::__thread_struct, std::__ndk1::default_delete<std::__ndk1::__thread_struct> >, void (std::__ndk1::__async_assoc_state<std::__ndk1::tuple<int, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > >, std::__ndk1::__async_func<main::$_4> >::*)(), std::__ndk1::__async_assoc_state<std::__ndk1::tuple<int, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > >, std::__ndk1::__async_func<main::$_4> >*> >(void*) ()
#9 0xf7348b84 in __pthread_start(void*) ()
from /apex/com.android.runtime/lib/bionic/libc.so
#10 0xf7302724 in __start_thread ()
from /apex/com.android.runtime/lib/bionic/libc.so
#11 0x00000000 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) thread 1
[Switching to thread 1 (LWP 4392)]
#0 0xf72727c8 in syscall ()
from /apex/com.android.runtime/lib/bionic/libc.so
(gdb) bt
#0 0xf72727c8 in syscall ()
from /apex/com.android.runtime/lib/bionic/libc.so
#1 0xf7277b2a in __futex_wait_ex(void volatile*, bool, int, bool, timespec const*) () from /apex/com.android.runtime/lib/bionic/libc.so
#2 0xf72be2f0 in pthread_cond_wait ()
from /apex/com.android.runtime/lib/bionic/libc.so
#3 0xf73b60be in std::__ndk1::condition_variable::wait(std::__ndk1::unique_lock<std::__ndk1::mutex>&) ()
from /data/data/com.termux/files/usr/lib/libc++_shared.so
#4 0xf73b788a in std::__ndk1::__assoc_sub_state::__sub_wait(std::__ndk1::unique_lock<std::__ndk1::mutex>&) ()
from /data/data/com.termux/files/usr/lib/libc++_shared.so
#5 0xaac103c4 in std::__ndk1::__assoc_state<std::__ndk1::tuple<int, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > > >::move() ()
#6 0xaabfaebc in main ()
Any idea why ?
It was compiled with clang-12 linked to bionic libc.
I tried it on arch with gcc there it worked fine . Not sure if it's an issue with clang or android .
Yue version: 0.7.15 (built with make release on main branch)
lua version 5.4 (compiled by yue, Though I have lua5.1 and luajit installed on system)
Also thanks for yuescript :)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the macro compilation crash on Android/Termux with YueScript 0.7.15, then inspect the isMacroChain and transformBlock frames named in the backtrace. Compare the same macro input on Arch with GCC and Android with clang-12. Done means macro-containing scripts compile without a segmentation fault on the affected Android setup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, cpp, lua
- Domain
- compilers, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100