Skip to content

fix: bugs found during cleanup - #4

Merged
codethinki merged 9 commits into
masterfrom
fix/bugs
Oct 4, 2026
Merged

codethinki merged 9 commits into
masterfrom
fix/bugs

Conversation

@codethinki

Copy link
Copy Markdown
Owner
  • exception.hpp: stack frames were printed twice (left over from a merge), end() - 2 dropped frames that are only runtime frames on msvc's main thread and was undefined for short traces. Now prints all frames that have a description.
  • constants.hpp: gcc and clang debug builds hit the "neither CTH_DEBUG_MODE nor CTH_RELEASE_MODE" error. Debug mode now defaults like assert (no NDEBUG = debug), gcc_debug preset added.
  • poly_vector: realloc leaked the previous block on every copy assignment (found with AddressSanitizer).
  • move_ptr::operator* returned a copy: *ptr = x did not compile, non-copyable pointees could not be dereferenced.
  • flag_val: 1 << id shifted an int, id 31 was sign extended, id >= 32 undefined.
  • union_find::merge(group_t) re-parented nodes instead of their roots, sets were not merged and sizes were wrong. Regression test added.
  • lib/cth_cmake: toolchain assertions now say what is missing (VCPKG_ROOT / vcpkg).

Lukas Thomann added 9 commits October 4, 2026 16:09
A merge left the frame loop in trace_string twice. Also print all frames
instead of dropping the last two (only matched msvc's main thread, undefined
for shorter traces) and skip frames without a description.
Same rule as assert. Only msvc defines _DEBUG, gcc and clang debug builds
hit the "neither CTH_DEBUG_MODE nor CTH_RELEASE_MODE" error.
realloc overwrote the pointer to the old block, every copy assignment
leaked it.
It returned a copy of the pointee, so *ptr = x did not compile and
non-copyable pointees could not be dereferenced.
1 << id shifted an int: id 31 produced a sign extended value, id >= 32
was undefined.
It re-parented the listed nodes instead of their roots, so nodes already in
another set left that set behind, and the set size only grew by one per node.
Adds reasons to the vcpkg assertions of the toolchain.
@codethinki
codethinki merged commit 42b4de0 into master Oct 4, 2026
6 checks passed
@codethinki
codethinki deleted the fix/bugs branch October 4, 2026 18:43
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.

1 participant