Skip to content
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: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## [4.5.2] - 2026-05-06
### Changed
- fix compiler segfault when there is no variable to mark as unreachable

## [4.5.1] - 2026-05-05
### Added
- special error message when trying to use a hidden symbol due to importing
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ project(ark CXX)
# ArkScript version (have to manually update it)
set(ARK_VERSION_MAJOR 4)
set(ARK_VERSION_MINOR 5)
set(ARK_VERSION_PATCH 1)
set(ARK_VERSION_PATCH 2)
set(ARK_VERSION_PRERELEASE 0)

# determine whether this is a standalone project or included by other projects
Expand Down
10 changes: 6 additions & 4 deletions include/Ark/Utils/Platform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
# define ARK_OS_LINUX
#endif

#if defined(__GNUC__) || defined(__clang__)
# define ARK_ALWAYS_INLINE __attribute__((always_inline))
#elif defined(_MSC_VER) && !defined(__clang__)
# define ARK_ALWAYS_INLINE __forceinline
#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
# if defined(__GNUC__) || defined(__clang__)
# define ARK_ALWAYS_INLINE __attribute__((always_inline))
# elif defined(_MSC_VER) && !defined(__clang__)
# define ARK_ALWAYS_INLINE __forceinline
# endif
#else
# define ARK_ALWAYS_INLINE
#endif
Expand Down
3 changes: 2 additions & 1 deletion src/arkreactor/Compiler/Lowerer/LocalsLocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ namespace Ark::internal

void LocalsLocator::markLastLocalAsUnreachable()
{
m_scopes.back().data.back().unreachable = true;
if (!m_scopes.back().data.empty())
m_scopes.back().data.back().unreachable = true;
}
}
10 changes: 9 additions & 1 deletion tests/unittests/resources/LangSuite/weird-tests.ark
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,12 @@
(test:eq res 5) }))

(var_after_cond false)
(var_after_cond true) }) })
(var_after_cond true) })

(test:case "no segfault when marking variables as unreachable in the compiler" {
(mut n 1)
(while (< n 10) {
(if (> n 1)
((let F (fun (m) (if m m 1))) n))
(set n (+ n 1)) })
(test:eq n 10) }) })
Loading