Skip to content

Commit 4c217fd

Browse files
committed
Fix SIGBUS on Apple Silicon in zlib_compress
Removes SAVE attribute from hash_table and hash_chain arrays in deflate_compress subroutine. The SAVE attribute caused these large arrays (32768 elements each) to be allocated as static data, which triggered memory alignment issues on ARM64 processors resulting in SIGBUS/EXC_BAD_ACCESS. Making these arrays automatic allocation resolves the alignment issue while maintaining identical functionality. Fixes #1408
1 parent a86458e commit 4c217fd

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

src/external/fortplot_zlib_core.f90

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,6 @@ subroutine deflate_compress(input_data, input_len, output_data, output_len)
562562
! Hash table for LZ77
563563
integer :: hash_table(0:HASH_SIZE-1)
564564
integer :: hash_chain(WINDOW_SIZE)
565-
save :: hash_table, hash_chain
566565

567566
! Huffman tables (fixed Huffman for simplicity)
568567
integer :: literal_codes(0:285)

0 commit comments

Comments
 (0)