-
Notifications
You must be signed in to change notification settings - Fork 2
Fix SIGBUS when saving PNG on Apple Silicon #1410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
PR Code Suggestions ✨Explore these optional code suggestions:
|
fa12f5a
to
946f79d
Compare
- Created fortplot_debug_utils.f90 module for reusable debug infrastructure - Moved debug utility functions from fortplot_zlib_core.f90 - Updated zlib_compress_into to use new debug module - Reduced fortplot_zlib_core.f90 from 1054 to 986 lines (under 1000 line hard limit) - File size compliance now passes: 0 critical violations Fixes CI failure where verify-size-compliance step was blocking PR merge. Debug functionality preserved with FORTPLOT_ZLIB_DEBUG environment variable.
Addresses qodo-merge code review feedback: - Removed duplicate fortplot_debug_utils.f90 module - Use existing fortplot_logging module's log_debug() function - Debug output controlled via FORTPLOT_ZLIB_DEBUG env var + log level - No duplication of logging infrastructure - File size: 999 lines (still under 1000 hard limit) Fixes: - Debug info leakage concern (uses proper logging facility) - Code duplication (removed redundant debug utilities) - Maintains FORTPLOT_ZLIB_DEBUG environment variable support
User description
Summary
Testing
PR Type
Bug fix, Enhancement
Description
Add
zlib_compress_into
subroutine to avoid returning large allocatablesKeep existing
zlib_compress
function as backwards-compatible wrapperUpdate PNG and PDF backends to use new helper
Add optional debug logging with environment variable control
Diagram Walkthrough
File Walkthrough
fortplot_zlib_core.f90
Add safer compression subroutine with debug logging
src/external/fortplot_zlib_core.f90
zlib_compress_into
subroutine that allocates output bufferdirectly
zlib_compress
to wrapper calling new subroutinefortplot_zlib.f90
Export new compression subroutine in bridge module
src/external/fortplot_zlib.f90
zlib_compress_into
to module exportsfunctions
fortplot_png.f90
Update PNG backend to use new compression subroutine
src/backends/raster/fortplot_png.f90
zlib_compress_into
instead ofzlib_compress
generate_png_data
fortplot_pdf.f90
Update PDF backend to use new compression subroutine
src/backends/vector/fortplot_pdf.f90
zlib_compress_into
instead ofzlib_compress
fortplot_pdf_io.f90
Update PDF I/O to use new compression subroutine
src/backends/vector/fortplot_pdf_io.f90
zlib_compress_into
instead ofzlib_compress
write_content_object