From 20c15ff91713a786dc8d7854ab5ef69bd303331e Mon Sep 17 00:00:00 2001 From: Sean T Allen Date: Tue, 3 Oct 2023 19:10:57 -0400 Subject: [PATCH] Fix compilation error when building with pool_memalign in release mode (#4455) Fixes #4431 --- .github/workflows/pr.yml | 11 +++++++---- .release-notes/fix-4431.md | 3 +++ src/libponyrt/mem/pool_memalign.c | 3 +++ 3 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 .release-notes/fix-4431.md diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 2c5f151a23..59eb834246 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -411,9 +411,12 @@ jobs: include: - image: ghcr.io/ponylang/ponyc-ci-x86-64-unknown-linux-ubuntu22.04-builder:20230924 debugger: lldb - directive: dtrace + directives: dtrace + - image: ghcr.io/ponylang/ponyc-ci-x86-64-unknown-linux-ubuntu22.04-builder:20230924 + debugger: lldb + directives: pool_memalign - name: use ${{ matrix.directive }} + name: use ${{ matrix.directives }} container: image: ${{ matrix.image }} options: --user pony --cap-add=SYS_PTRACE --security-opt seccomp=unconfined @@ -437,13 +440,13 @@ jobs: key: libs-${{ matrix.image }}-${{ hashFiles('Makefile', 'CMakeLists.txt', 'libs/CMakeLists.txt') }} - name: Build Debug Runtime run: | - make configure arch=x86-64 config=debug use=${{ matrix.directive }} + make configure arch=x86-64 config=debug use=${{ matrix.directives }} make build config=debug - name: Test with Debug Runtime run: make test-ci config=debug usedebugger='${{ matrix.debugger }}' - name: Build Release Runtime run: | - make configure arch=x86-64 config=release use=${{ matrix.directive }} + make configure arch=x86-64 config=release use=${{ matrix.directives }} make build config=release - name: Test with Release Runtime diff --git a/.release-notes/fix-4431.md b/.release-notes/fix-4431.md new file mode 100644 index 0000000000..dc82239518 --- /dev/null +++ b/.release-notes/fix-4431.md @@ -0,0 +1,3 @@ +## Fix compilation error when building with pool_memalign in release mode + +When attempting to build the Pony runtime with the `pool_memalign` option, users would encounter a compilation error if building a `release` rather than `debug` version of the runtime. We've fixed the compilation error and added CI testing to verify we don't get a regression. diff --git a/src/libponyrt/mem/pool_memalign.c b/src/libponyrt/mem/pool_memalign.c index cebfe861e3..d173099892 100644 --- a/src/libponyrt/mem/pool_memalign.c +++ b/src/libponyrt/mem/pool_memalign.c @@ -27,6 +27,7 @@ void* ponyint_pool_alloc(size_t index) else { int code = posix_memalign(&p, POOL_ALIGN, size); + (void)code; pony_assert(code == 0); } @@ -35,6 +36,7 @@ void* ponyint_pool_alloc(size_t index) void ponyint_pool_free(size_t index, void* p) { + (void)index; pony_assert(index < POOL_COUNT); free(p); @@ -44,6 +46,7 @@ static void* pool_alloc_size(size_t size) { void* p; int code = posix_memalign(&p, POOL_ALIGN, size); + (void)code; pony_assert(code == 0); return p;