Build Tricycle memory safety checker foundation#408
Open
nbeerbower wants to merge 4 commits into
Open
Conversation
Tricycle is an opt-in static analyzer that proves memory safety properties for Hemlock programs. It provides: - Double-free detection (TRIC001) - Use-after-free detection (TRIC002) - Use-after-move detection (TRIC003) - Memory leak detection (TRIC004) - Async lifetime safety (TRIC006) - Ownership tracking Features: - CLI tool: `tricycle check program.hml` - Supports --strict, --all, --json output modes - Integrates with existing type checker for type-aware analysis - Proper diagnostic formatting with related locations and hints New files: - include/tricycle/tricycle.h - Public API and data structures - src/backends/tricycle/tricycle.c - Context and diagnostics - src/backends/tricycle/ownership.c - Ownership analysis engine - src/backends/tricycle/main.c - CLI entry point - tests/tricycle/ - Test suite with 7 ownership tests Build: `make tricycle` Test: `make test-tricycle`
The CheckedType returned by type_check_infer_expr was not being freed, causing a 96-byte leak per call. Now properly call checked_type_free() after checking the type kind.
This allows tricycle to be built with ASAN and other linker flags passed via EXTRA_LDFLAGS, consistent with other build targets.
Tricycle test files contain intentional memory bugs (double-free, use-after-free, etc.) that are meant to be analyzed by the tricycle static analyzer, not executed by the hemlock interpreter. Changes: - Exclude tests/tricycle/ from the main test runner (run_tests.sh) - Fix tricycle test runner by removing 'set -e' which caused premature exit due to (( PASSED++ )) returning 1 when PASSED=0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tricycle is an opt-in static analyzer that proves memory safety properties for Hemlock programs. It provides:
Features:
tricycle check program.hmlNew files:
Build:
make tricycleTest:
make test-tricycle